yeojz / metalsmith-react-templates

A metalsmith plugin to render files using React / Preact / JSX based templates.
MIT License
92 stars 17 forks source link

Add an isomorphic example #2

Closed dahmian closed 9 years ago

dahmian commented 9 years ago

Do you have any examples of running React on the server and the client? I think it would be useful to help people get started. I threw together a quick example here.

yeojz commented 9 years ago

@dahmian Thanks. A bit busy at work this week. Will check it out over the weekend.

yeojz commented 9 years ago

Took a quick glance at it... One thing to note is that React.renderComponent is going to be deprecated in future versions of React.

Off hand, I think the syntax should be:

var Entry = React.createFactory(require('../templates/entry.jsx'));
React.render(new Entry(props), document.body);
yeojz commented 9 years ago

bc9f668 - Merge branch 'master' of github.com:yeojz/metalsmith-react-templates into pr/2 27d39e5 - cleaned up PR and styles to conform with library style