ecohabit
ecohabit copied to clipboard
Refactor: Remove Login and Register Context
Why?
- These are defined as context at the top level of the app that will:
- cause re renders anytime a form input changes when user is logging in / registering
- cause performance issues due to large amounts of input changes that cause re renders
- Encapsulate the sign in and sign up functionality into their respective form components
How?
- Login and Register components should track their own input via states defined in that same component
- create handler functions that update this state when input changes
- on submission, make sure that these new states and their values are being used instead of the old context
- remove all imports and lines related to old files
- Delete LoginContext and RegisterContext files
- Delete all imports from these files wherever they exist
- Delete these contexts from
App.jsfile
- Update
ResponsiveAppBarcomponent- Right now it uses the
isLoggedInvalue from the LoginContext. Use UserContext instead and check for the truthly value ofuserto check if user is logged in / exists.
- Right now it uses the
- Search for additional usages of these contexts and make appropriate updates (feel free to ask questions)
hi @lugenx if this issue is still open can you please assign it to me
I would like to handle this, could you assign this to me ?