WebTechKitchen; Your Web Technology Kitchen, contact us to create, or maintain your websites and other digital properties.

JSX with React within a Drupal application

Submitted by barnettech on Wed, 06/26/2019 - 14:39

"Tip: To be able to use JSX you would have to use Webpack first to compile your JavaScript file and then add it to Drupal. A good approach then would be to use the create-react-app repo to start and then just copy over the resulting js file created after transpilation and embed that. You would then not need to embed react.js separately because it is already bundled in transpilation. Setting this up, however, so that auto refresh would work and the file would be copied to Drupal, is a bit more complicated and therefore we are skipping it."

footnote: https://www.droptica.com/blog/how-use-react-drupal/

other resources:
https://danielgading.com/2018/09/06/drupal-8-and-react-a-progressive-en…

https://github.com/OsioLabs/react-and-drupal-examples/tree/hello-world

https://www.quora.com/What-exactly-is-BabelJs-Why-does-it-understand-JS…