0

My app is made by 2 components: a list and an item list detail that is rendered clicking on a list item and opening in a new page tab. I should be able to edit the list item in the new tab and make this change visible in the list tab too (the list and the list item detail show this editable info)

How can I update the state of a component from another component opened on a new page?

I am using Router Link to open the new tab with some parameters like item id.

Thanks a lot

Muhammad Zeeshan
  • 4,608
  • 4
  • 15
  • 41
dev2020
  • 1
  • 2

2 Answers2

0

You can probably use the localStorage of your browser to exchange information between two pages if they share the same domain.

In your listView page you can attach a listener to the localStorage and trigger re-render whenever the value associated with the required key changes.

0

Well, if you open a new tab and want to communicate between them, you leave the scope of React (which is used for single page app).

Maybe using BroadcastChannel API can help you: Communication between tabs or windows