inducer
v0.3.2
Published
Inject Redux reducer with HOC
Downloads
8
Readme
Inducer
Inject Redux Reducer in a HOC way!
Install
$ yarn add inducer
Show me how!
// YourComponent.js
import gameReducer from './gameReducer';
import injectReducer from 'inducer';
class YourComponent extends React.Component {
// component logic here
}
export default injectReducer({
game: gameReducer
})(YourComponent);
// App.js
import React from 'react';
import { Provider } from 'react-redux';
import YourComponent from './YourComponent.js'
export default function App({ store }) {
return (
<Provider store={store}>
<!-- this is important as the HOC will get the store
from the context provided by the store provider -->
<YourComponent />
</Provider>
)
}