Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wednesday-solutions/react-floki i…
Browse files Browse the repository at this point in the history
…nto feat/remove-useInjectSaga
  • Loading branch information
alichherawalla committed Feb 1, 2022
2 parents d68fec0 + cde8ada commit ff205c8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
4 changes: 2 additions & 2 deletions generated-files/container/HomeContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Helmet } from 'react-helmet';
import { createStructuredSelector } from 'reselect';
import { compose } from 'redux';
import { injectSaga } from 'redux-injectors';
import makeSelectHomeContainer from './selectors';
import selectHomeContainerDomain from './selectors';
import saga from './saga';

export function HomeContainer() {
Expand All @@ -31,7 +31,7 @@ export function HomeContainer() {
HomeContainer.propTypes = {};

const mapStateToProps = createStructuredSelector({
homeContainer: makeSelectHomeContainer(),
homeConatiner: selectHomeContainerDomain(),
});

function mapDispatchToProps(dispatch) {
Expand Down
17 changes: 8 additions & 9 deletions generated-files/container/HomeContainer/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import { initialState } from './reducer';
* Direct selector to the homeContainer state domain
*/

const selectHomeContainerDomain = state =>
(state.homeContainer || initialState).toJS();
export const selectHomeContainerDomain = state => state.homeContainer || initialState

const makeSelectHomeContainer = () =>
createSelector(
selectHomeContainerDomain,
substate => substate,
);
/**
* use createSelector if you are doing something with the returned state.
* https://redux.js.org/usage/deriving-data-selectors#createselector-overview
* e.g: const makeSelectHomeContainer = () =>
* createSelector(selectHomeContainerDomain, substate => get(substate, 'somevalue'))
*/

export default makeSelectHomeContainer;
export { selectHomeContainerDomain };
export default selectHomeContainerDomain
4 changes: 2 additions & 2 deletions generators/container/index.js.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { compose } from 'redux'
import { injectSaga } from 'redux-injectors';
{{/if}}
{{#if wantActionsAndReducer}}
import makeSelect{{properCase name}} from './selectors'
import select{{properCase name}} from './selectors'
{{/if}}
{{#if wantSaga}}
import saga from './saga'
Expand All @@ -50,7 +50,7 @@ export function {{ properCase name }}() {

{{#if wantActionsAndReducer}}
const mapStateToProps = createStructuredSelector({
{{ camelCase name }}: makeSelect{{properCase name}}(),
{{ camelCase name }}: select{{properCase name}}(),
})
{{/if}}

Expand Down
15 changes: 10 additions & 5 deletions generators/container/selectors.js.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ import { initialState } from './reducer'
* Direct selector to the {{ camelCase name }} state domain
*/

const select{{ properCase name }}Domain = state => state.{{ camelCase name }} || initialState
export const select{{ properCase name }}Domain = state => state.{{ camelCase name }} || initialState

const makeSelect{{ properCase name }} = () =>
createSelector(select{{ properCase name }}Domain, substate => substate)

export default makeSelect{{ properCase name }}
export { select{{ properCase name }}Domain }

/**
* use createSelector if you are doing something with the returned state.
* https://redux.js.org/usage/deriving-data-selectors#createselector-overview
* e.g: const makeSelect{{ properCase name }} = () =>
* createSelector(select{{ properCase name }}Domain, substate => get(substate, 'somevalue'))
*/

export default select{{ properCase name }}Domain
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-floki",
"version": "1.0.87",
"version": "1.0.90",
"description": "A React component, container and test generation library",
"repository": {
"type": "git",
Expand Down

0 comments on commit ff205c8

Please sign in to comment.