Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default (state = {}, action) => {
- switch(action.type) {
- case 'addConnection':
- return {
- connections: {
- ...state.connections, {
- action.compositeKey: action.connection
- }
- }
- default:
- return state
- }
- }
- const reducer = (state = {}, action) => {
- switch (action.type) {
- case 'addConnection':
- return Object.assign({}, state, {
- connections: [
- ...state.connections,
- {
- [actions.compositeKey]: action.connection
- }
- ]
- });
- default:
- return state;
- }
- }
- export default reducer;
- const reducer = (state = {}, {type, compositeKey, connection}) => {
- switch (type) {
- case 'addConnection':
- return Object.assign({}, state, {
- connections: state.connections.concat({
- [compositeKey]: connection
- })
- });
- default:
- return state;
- }
- }
- export default reducer;
- import Immutable from 'immutable';
- const reducer = (state = Immutable.Map(), {type, compositeKey, connection}) => {
- switch (type) {
- case 'addConnection':
- return state.set(
- 'connections',
- state.get('connections').concat({
- [compositeKey]: connection
- })
- );
- default:
- return state;
- }
- }
- export default reducer;
- const reducer = (state = {}, {type, compositeKey, connection}) => {
- switch (type) {
- case 'addConnection':
- var newData={};
- newData[compositeKey]=connection;
- return Object.assign({}, state, newData)
- });
- default:
- return state;
- }
- }
- export default reducer;
Add Comment
Please, Sign In to add comment