DEV Community

Discussion on: Don't be too dependent on useState, useRef is there for you

Collapse
 
sakethkowtha profile image
sakethk
Collapse
 
shubhamtiwari909 profile image
Shubham Tiwari

The question is
I have a list in my 'Home Page' and there is another 'Add User' page
So when I add a user on my 'Add User' page using a button, Then how can I show the list of users on my 'Home Page' using map function.

It's like using a button a add something on one page and then show that thing on another page.

I want the logic and some help

Thread Thread
 
shubhamtiwari909 profile image
Shubham Tiwari

For example if add a name using input field and that things is added to list but I want to show that list on a different page not on the one I used to add it

Thread Thread
 
sakethkowtha profile image
sakethk

You can try two things

  1. React context or
  2. React Redux

i would say react context will be the better option
refer this for context kentcdodds.com/blog/how-to-use-rea...

Thread Thread
 
sakethkowtha profile image
sakethk

this is basic example : daveceddia.com/usecontext-hook/

Thread Thread
 
shubhamtiwari909 profile image
Shubham Tiwari

Thank you I get the concept
I will try to implement it for my project hope it may work