retax-core
v1.2.1
Published
Universal React Redux Framework
Downloads
41
Maintainers
Readme
Retax-Core
This is the core of the retax framework. Its role is to bootstrap your universal react / redux application and to setup everything if you want to use optionnal retax modules.
Using Retax
Check theses projects to learn how to use retax: retax-client or retax-server.
What retax does?
Bootstrapping
When you bootstrap a retax application (whether on client or on server: the code of retax-core is 100% universal), these lifecycle events will happened in order:
- Read the initial app state
- on the client, from a
window.__INITIAL_STATE__
- on the client, from a
- Read the
authentication cookie
- on the client, from the dom cookie (using
js-cookie
) - on the server, from the request
- on the client, from the dom cookie (using
- Initialize the redux store and initialize a retax reducer
- Run an optionnal hook (set by the user) to allow user to dispatch early actions
- Initialize react-router and do the route matching
- Run an optionnal hook (set by the user) to allow user to dispatch actions impacting rendererd components
- Generate the JSX of the corresponding app
- on the server, retax-core populate
window.__INITIAL_STATE__
with the corresponding initial state.
- on the server, retax-core populate
The rendering is delegated to these modules retax-client or retax-server.
retax-core literally just build the application.
Provide a inversion of control container to retax modules
Your application will be wrapped by a component <RetaxProvider />
. This component exposes to its children a IoC container.
This allows them to use dependency injection. This is highly used by all retax modules.
FAQ
I don't understand how this library is built
Check builder and builder-ts-library
Typescript support
This project is shipped with typescript typings. If you are using typescript@^1.6, you don't have to do anything, it will detect the definition types automatically.
Thanks
Thanks to remojansen for the project inversify. This project is intensively used by retax-core and allow it to be 100% universal.
##License MIT License (MIT)