-
Notifications
You must be signed in to change notification settings - Fork 41
Setting Up React
Gilbert edited this page Oct 14, 2016
·
3 revisions
First install the packages:
npm install --save react react-dom reactify
Then add to your browser transform in server/index.js
:
routes.get('/app-bundle.js',
- browserify('./client/app.js'))
+ browserify('./client/app.js', {
+ transform: [ require('reactify') ]
+ }))
And that's it! Now you can start using react in client/app.js
. Here's a starting point (replace the code in client/app.js
with the following):
// client/app.js
var React = require('react');
var ReactDOM = require('react-dom');
ReactDOM.render(
<h1>Hello, world!</h1>, // JSX
document.getElementById('app')
);