Awesome
Webpacker-React sample application
This is a very basic Rails application to showcase usage of Webpacker-React.
Please read Webpacker-React documentation for more details.
Usage
First, clone this repository and install dependancies :
$ cd webpacker-react-example
$ bundle
$ ./bin/yarn
You then need to run Webpack to compile the javascript code :
$ ./bin/webpack
Now you can run the Rails app :
$ ./bin/rails server
Finally open http://localhost:3000/ in your browser.
Contents
Hello: Sample React component
Very basic React component, nothing special.
Hello React pack file
Packfiles are entrypoints for Webpacker's managed Javascript.
For Webpacker-React to work, you need to import
your component and register
it for later use in your app.
React component rendered from a view
Use the react_component()
method from a view to render a previously registered component.
React component rendered from a controller
You can also use render react_component: 'Component'
from a controller to render it.
Development
You are encouraged to use this example application to test any development you make on the Webpacker-React code base. Please see its README for more details.