In this post, we will see how to resolve Exporting uesState variable into another compenent/page
Question:I’m a bit stuck. I’ve put the users input results into an array that can be used on another component. However when I try to destructure the ‘newList’ in another component/page it doesn’t show anything or it returns [
Object object]when I console.log it.
This is where the data is put into an array
Best Answer:Firstly, in the
formSubmitfunction – you would want to spread the input in the newList array as well, or else it would be something like
If you have better answer, please add a comment about this, thank you!