happypoulp / redux-tutorial

Learn how to use redux step by step
3.76k stars 546 forks source link

Line termination and speling #34

Closed lizell closed 9 years ago

lizell commented 9 years ago

I do not know if omitting semi-colons was intentional, but here is a PR to "fix" that. It also fixes some minor spelings and renames the example action ADD_ITEM to SET_ITEM.

happypoulp commented 9 years ago

Hi,

Actually omitting semi-colons was totally intended ;). It's kind of a coding convention I like and try to follow so I'd rather keep it like that.

As for the renaming of ADD_ITEM to SET_ITEM, I feel that it would be misleading to name this action SET_ITEM since it really is an action to ADD a new item to the array of items, see the itemsReducer code for that action below:

    case 'ADD_ITEM':
        return [
            ...state,
            action.item
        ]

If we had only one item reference and wanted to replace it by a new one, SET_ITEM would definitely have been a better name.

Does it make sense?

I'd be glad to merge your "Added ignore for IntelliJ" commit.

lizell commented 9 years ago

Ah, never mind the semi colons then! ;)

You are of course correct with the ADD_ITEM, I misunderstood the code, the first time I read it. Sorry about that. You'll find a new PR at #38. I'll close this one.

Thanks!