Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to function components & React Hooks #135

Open
9 of 12 tasks
thadk opened this issue Dec 25, 2019 · 7 comments
Open
9 of 12 tasks

Convert to function components & React Hooks #135

thadk opened this issue Dec 25, 2019 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@thadk
Copy link
Member

thadk commented Dec 25, 2019

The code organization would be a lot clearer if we used function components and React Hooks instead of class components.

We now have useUserState and useUserStateActions hooks to access the state of the app and manipulate it, respectively.

Converted src/pages/* to function components?:

Other major components:

Feel free to create new component files as you go.

@thadk thadk added the help wanted Extra attention is needed label Dec 25, 2019
@thadk
Copy link
Member Author

thadk commented Dec 25, 2019

@olena-ageyeva do you want to help with this in early 2020? We are going to try to release everything on Jan 17, so ideally we'd have this sorted out a week and a half before.

@olena-ageyeva
Copy link
Collaborator

@thadk Sure. I'd be delighted to. You'd like it to be completed by January 6-7sh, right? It looks like a lot of refactoring work in a short time, but I agree it will significantly simplify the code and it does make sense to do so before the release. Will start working on it now.

@thadk
Copy link
Member Author

thadk commented Dec 26, 2019

Wow, great, whatever you think you can contribute will help.

I just added you to the project, maybe we can work on a (feel free to create) reactHooks branch on the main repository instead of using the forked branch git model so we can collaborate more directly.

An early version to show everyone the concept on Tue Jan 7 when we meet next would be excellent–I'm sure folks will need a bit of introduction to the new way of managing variables, etc.

@olena-ageyeva olena-ageyeva self-assigned this Dec 29, 2019
@thadk
Copy link
Member Author

thadk commented Jan 9, 2020

New way to manage state is proposed in #142 which can be function component and/or hooks-compatible.

@thadk
Copy link
Member Author

thadk commented Feb 5, 2021

If you want to work on this for one of the other files: src/pages/prescreen-1d.tsx look at the two commits here: https://github.com/codeforboston/windfall-elimination/pull/251/files (it is currently skipped as has unfinished features: to see this file running for now you need to either go directly to the URL: e.g. https://ssacalculator.org/prescreen-1d/ or enable with the feature toggle GATSBY_SHOW_FUTURE_EARNINGS_PAGE=true npm start)

Reading this code around the useUserStateActions and useUserState might help too: https://github.com/codeforboston/windfall-elimination/blob/develop/src/pages/screen-2a.tsx

@thadk
Copy link
Member Author

thadk commented Feb 5, 2021

cc: @olena-ageyeva @linesbetween I updated this issue if you'd like to help on it. We also have the example as in the last comment.

@thadk
Copy link
Member Author

thadk commented May 1, 2021

Related PR: #294

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants