Warning: You are browsing the documentation for Symfony 3.3, which is no longer maintained.

Read the updated version of this page for Symfony 5.3 (the current stable version).

Enabling React.js

3.3 version

Enabling React.js

Using React? Make sure you have React installed, along with the babel-preset-react:

1
$ yarn add --dev react react-dom prop-types babel-preset-react

Enable react in your webpack.config.js:

1
2
3
4
5
6
7
// webpack.config.js
// ...

Encore
    // ...
    .enableReactPreset()
;

That’s it! Your .js and .jsx files will now be transformed through babel-preset-react.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.