Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages showcasing Symfony with Docker, APIs, queues & async tasks, Webpack, SPAs, etc.

WARNING: You are browsing the documentation for Symfony 4.0 which is not maintained anymore. Consider upgrading your projects to Symfony 5.2.

Enabling React.js

4.0 version

Enabling React.js

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

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

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.