Skip to content

tanhauhau/inducer

Repository files navigation

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

Releases

No releases published

Packages

No packages published