Export useState variable to another component/page
P粉311423594
P粉311423594 2024-04-05 11:30:54
0
1
458

I'm a little stuck. I have put the user input results into an array that can be used on another component. However, when I try to deconstruct "newList" in another component/page, it doesn't display anything or when I console.log it returns [Object object].

This is where the data is put into the array

P粉311423594
P粉311423594

reply all(1)
P粉133321839

First, in the formSubmit function - you also want to propagate the input into the newList array, otherwise it will look like

[[{}, {}], {},{}]

So, to get the correct list, propagate the input as follows:

newList =[...input, ...userEnquiry]
    setUserEnquiry(newList)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template