Brown D8React Integration is a Drupal 8 module for handling the insertion of compiled react applications.
Using Composer, Add the repository:
{
"type": "vcs",
"url": "[email protected]:webserv/brown-d8react-integration.git"
}
and require the module:
"require": {
"webserv/brown-d8react-integration": "dev-master"
}
Run composer install, and the module will be available to be enabled via the Drupal interface.
- Add a new Basic Page content type.
- In the section
Below Content Components
in the dropdown, selectAdd React App
- In the
React Apps
dropdown, select the name of the app. - Save the page, and the React App will render in the
Below Content Components
block.
- Compile the app down to a single
.js
file - Add the app to the
/apps
directory
Note: The .js
filename will be used as the ID of the DIV that the app is rendered in, as well as the entry in the select menu with -
converted to spaces, and individual words capitalized.
Example: todo-app.js
needs to be looking for <div id='todo-app'></div>
as its base div, and will display in the menu as Todo App