Reputation: 559
Scenario:
I have tried to solve this problem with updating the data state when the page is didMount, cache the previous data, and revert it back when the page is unmounting. But, I think it is will affect to the database because everytime a user visit the details page, it will send data to the database.
So, I want to know if there is alternative to solve this problem with a realtime approach in ReactJS.
Upvotes: 0
Views: 54
Reputation: 536
The frontend is executed in the browser of each user, and the data inside the frontend is duplicated for every user. So you can't solve your problem involving just the frontend. You need to inform the backend that a user is editing the page, and then the backend shoud inform the frontend that the page is in editing state.
Upvotes: 1