ecohabit icon indicating copy to clipboard operation
ecohabit copied to clipboard

Refactor: Remove Login and Register Context

Open rcamach7 opened this issue 2 years ago • 2 comments

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.js file
  • Update ResponsiveAppBar component
    • Right now it uses the isLoggedIn value from the LoginContext. Use UserContext instead and check for the truthly value of user to check if user is logged in / exists.
  • Search for additional usages of these contexts and make appropriate updates (feel free to ask questions)

rcamach7 avatar Jul 28 '23 01:07 rcamach7

hi @lugenx if this issue is still open can you please assign it to me

Saurabh-Rana17 avatar Aug 19 '24 12:08 Saurabh-Rana17

I would like to handle this, could you assign this to me ?

sumitxae avatar Oct 08 '24 09:10 sumitxae