How to use the renderToStaticMarkup function from react
Find comprehensive JavaScript react.renderToStaticMarkup code examples handpicked from public code repositorys.
GitHub: jxnblk/react-icons
1 2 3 4 5 6 7 8 9 10
var React = require('react') var Cog = require('./Cog') var build = function(name, props) { var svg = React.renderToStaticMarkup(React.createElement(Cog, props)) fs.writeFileSync('icons/' + name + '.svg', svg) }
13
135
9
44 45 46 47 48 49 50 51 52 53
var list = fs.readdirSync(ENTRIES_DIR).filter(function(dir) { return isDirectory(path.join(ENTRIES_DIR, dir)); }).map(function (dir) { return React.DOM.li({}, React.DOM.a({href: '/'+dir}, dir.replace(/-/g, ' '))); }); var markup = React.renderToStaticMarkup(( React.DOM.html({}, React.DOM.link({rel: 'stylesheet', href: '/shared.css'}), React.DOM.body({id: "index"}, React.DOM.ul({}, list)
7
101
7
GitHub: jdlehman/skin-deep
9 10 11 12 13 14 15 16 17 18
TestUtils = require('react-addons-test-utils'); } function renderToStaticMarkup(element) { if (React013) { return React.renderToStaticMarkup(element); } return require("react-dom/server").renderToStaticMarkup(element); }
39
0
2
GitHub: koistya/gulp-render
48 49 50 51 52 53 54 55 56 57
/** * Just produce static markup without data-react-* attributes * http://facebook.github.io/react/docs/top-level-api.html#react.rendertostaticmarkup */ function renderToStaticMarkup(page) { return React.renderToStaticMarkup(React.createElement(page)); } // Plugin level function (dealing with files) function Plugin(options) {
9
26
2
104 105 106 107 108 109 110 111 112 113
container, horizontalAlignment, verticalAlignment, browserSupport ); var code = React.renderToStaticMarkup(parent); var formattedCode = html.prettyPrint( code, { indent_size: 2,
48
0
20
+ 3 other calls in file
react.default is the most popular function in react (505 examples)