An example of how you can use React JS framework with nodeject dependency injection manager to build applications.
This is the default approach that I implemented back in Summer 2014 for all the redditgifts React applications.
The advantages of this approach are:
- Cleaner and more readable code;
- Easily share React JS components between your React applications;
- Include different npm modules into your React application;
- One js file per application: compiled, bundled and minified;
- Unit tests are much easier with dependency injection.
There are two demo applications:
-
A simple demo app with only 3 ReactJS modules:
-
A more complex demo app with 5 React modules and 2 sub apps:
In order to get compiled js files run grunt
command form a command line.
Remember, it's just an example. Feel free to modify and expand it based on your project's needs.
Alexandr Marinenko