Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 1 KB

reactjs.rst

File metadata and controls

38 lines (24 loc) · 1 KB

Enabling React.js with Webpack Encore

Screencast

Do you prefer video tutorials? Check out the React.js screencast series.

Tip

Check out live demos of Symfony UX React component at https://ux.symfony.com/react!

Using React? First add some dependencies with npm:

$ npm install react react-dom prop-types --save

Enable react in your webpack.config.js:

  // webpack.config.js
  // ...

  Encore
      // ...
+     .enableReactPreset()
  ;

Then restart Encore. When you do, it will give you a command you can run to install any missing dependencies. After running that command and restarting Encore, you're done!

Your .js and .jsx files will now be transformed through babel-preset-react.