Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementation detail
State management
To share the state between the different components during the sign-up flow, I'm using a reducer (/reducer/signUpReducer.js) to manage the state logic outside of the components.
The state managed by this reducer will be put in the Context so each child component of the Context provider will easily get access to the state.
In other words, I'm combining the reducer and context together so every component in the tree can simply call the
dispatch
function from the reducer to update the state. Please check theApp.js
to see the tree structure.Routing
I'm using
react-router
v6 to easily manage the routing between the different pages in the sign-up flow.Form
I'm using
formik
v2 to easily manage the state and error handling in the sign-up forms. Also, I can add a schema validation file (/schema/index.js) for the input validations.Components structure
I follow the atomic design. Thus, I keep atomic components in the atoms folder and components that reuse atomic
components in the components folder.