- Requires Gutenberg plugin, which bundles React into WP
- Download the base directory
react-wp-plugin
to plugins folder of your local dev server - Create a WP page with slug 'react-in-wp' and content like "hmm, react has not loaded"
- Activate the plugin & check your page for React welcome message
- Problems? Check settings in files:
react-wp-plugin.php
andassets/js/main.js
- Works? start the tooling below & try the other snippets in
src/index.js
- First, run
npm install
inside the base directory of this plugin. This will install all NPM Modules listed in the package.json file. - Next, run
npm run dev
to watch thesrc/index.js
file for changes and compile everything intoassets/js/main.js
andassets/css/main.css
- Finally, you can use
npm run build
to just compile thesrc/index.js
file intoassets/js/main.js
andassets/css/main.css
.