Skip to content

Latest commit

 

History

History
45 lines (36 loc) · 1.04 KB

README.md

File metadata and controls

45 lines (36 loc) · 1.04 KB

Inducer

Build Status GitHub license PRs Welcome

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>
  )
}