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 in full color showing how to combine Symfony with Docker, APIs, queues & async tasks, Webpack, Single-Page Applications, etc.

Buy printed version

Enabling React.js

Enabling React.js

Screencast

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

Using React? First add some dependencies with Yarn:

1
2
$ yarn add @babel/preset-react --dev
$ 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()
;

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.

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