Guest User

Untitled

a guest
Jan 2nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. {
  2. general:{duration:100,strength:100},
  3. gameA:{strength:50},
  4. gameB:{duration:50}
  5. }
  6.  
  7. const mapStateToProps = (state) => {
  8. return {
  9. duration: state.general.duration,
  10. strength: state.general.strength
  11. }
  12. export default connect(mapStateToProps)(GameA);
  13.  
  14. const mapStateToProps = (state) => {
  15. let {duration, strength} = state.general;
  16. if(state.gameA && state.gameA.duration) duration = state.gameA.duration;
  17. if(state.gameA && state.gameA.strength) strength= state.gameA.strength;
  18. return {
  19. duration: duration,
  20. strength: strength
  21. }
Add Comment
Please, Sign In to add comment