react-octopus
Develop your React applications quickly and easily!
Table Of Contents
Installation
npm
$ npm install react-octopus
yarn
$ yarn add react-octopus
If you want to use all modules
:
$ npm install react-octopus react-dom react-helmet redux react-redux react-router-config react-router-dom$ npm install --save-dev express isomorphic-fetch
or
$ yarn add react-octopus react-dom react-helmet redux react-redux react-router-config react-router-dom$ yarn add --dev express isomorphic-fetch
How To Use
Examples:
react-octopus
includes many ready solutions (tentacles
) for different purposes. A list of tentacles
must be specified when creating Octopus
.
const config = tentacles: tentaclesStore // Different variants of creation:core = configcore = Octopus // Use singleton patterncore = Octopus // Calls a function if `Octopus` is not created
By adding tentacles
you can change a behavior of your application.
Examples:
- tentacles.Store - allows you to create
Redux
store throughOctopus
. - tentacles.Store, tentacles.SSR - now you can easily render your application on a server.
- tentacles.Store, tentacles.SSR, tentacles.Helmet, modules.Router - this adds data for document head (
title
,meta
, etc) and routing viareact-router
.
Ready Solutions (tentacles)
tentacles.Store (Redux)
Dependencies: redux
, redux-thunk
.
$ npm install redux redux-thunk
Example:
const octopus = tentacles: tentaclesStore ... store: initialState: {} enhancer:
See React Redux.
tentacles.Router
Dependencies: react-router
, react-router-config
, react-router-dom
.
$ npm install react-router react-router-config react-router-dom
Example:
const routes = component: AppRoot routes: path: '/' component: UserList const octopus = tentacles: tentaclesRouter ... routes: routes // routes for SSR
See React Router.
tentacles.SSR
Server-side rendering 😎
Dependencies: express
, react-dom
, serialize-javascript
.
$ npm install express react-dom serialize-javascript
Example:
const express = const app = app
tentacles.Helmet
Adds
Helmet
data for tentacles.SSR.
Dependencies: react-helmet
.
$ npm install react-helmet
See React Helmet.
How To Create A New Module
See /src/tentacles/.
License
MIT