Created
March 23, 2017 09:02
-
-
Save anupvarghese/65ee5dc9422622b183e34cb0bf179768 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { combineReducers } from 'redux'; | |
import level1 from './level1'; | |
export default combineReducers({ | |
data: level1, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
someId: { | |
id: '123', | |
}, | |
data: { | |
level1: { | |
someMap: [ | |
{ id: '123' }, | |
{ id: '456' }, | |
] | |
}, | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import C from '../constants'; | |
import initialState from '../initial_state'; | |
import { fromJS } from 'immutable'; | |
export default (state = fromJS(initialState.data), action) => { | |
switch (action.type) { | |
default: { | |
return state; | |
} | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { connect } from 'react-redux'; | |
import { fromJS } from 'immutable'; | |
const props = { someId: '123' }; | |
const Simple = (props) => ( | |
<div>testing</div> | |
); | |
export default connect( | |
(state, ownProps = props) => { | |
const someId = ownProps.someId; | |
const someMap = state.data | |
.getIn(['level1', 'someMap']) | |
.filter(some => { | |
console.log(some) | |
return some.get('id') === someId | |
}); | |
return ({ | |
someMap, | |
}); | |
}, | |
)(Simple); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment