This is one of a series of changes for newColumn functionality ticket. For this component, in order to have Project in global scope, this PR is focused on the context & reducer(store) part. I got inspired by React's documentation's suggestion to use useReducer + ContextAPI. This change really looks like Redux but is done by only React APIs. I hope you are familiar with the redux ecosystem.
Why not use state management library like Redux?
I wanted to keep the change minimal because these libraries tend to introduce a decent amount of boilerplates which costs us some time to set up. Since this app only needs Project to be global so far, I've just decided to follow React's recommendation which follows Redux's action-to-reducer pattern, so the abstraction can easily be applied to Redux library even if we decided to go with it.
Ticket
https://github.com/ryonryon/trello-clone/issues/60
Description
This is one of a series of changes for
newColumn
functionality ticket. For this component, in order to haveProject
in global scope, this PR is focused on the context & reducer(store) part. I got inspired by React's documentation's suggestion to useuseReducer
+ContextAPI
. This change really looks like Redux but is done by only React APIs. I hope you are familiar with the redux ecosystem.Why not use state management library like Redux?
I wanted to keep the change minimal because these libraries tend to introduce a decent amount of boilerplates which costs us some time to set up. Since this app only needs
Project
to be global so far, I've just decided to follow React's recommendation which follows Redux's action-to-reducer pattern, so the abstraction can easily be applied to Redux library even if we decided to go with it.Documentation's recommendation: https://reactjs.org/docs/hooks-faq.html#how-to-avoid-passing-callbacks-down