Search code examples
reactjsreduxstorage

ReactJS: Persistent Storage Options - Modal Dismissal


Warning: I know this is really too broad for SO, but i'm not sure where else to pose this question...

We have a react / redux application and need to create a modal that appears once for the user and then after dismissed, will not reappear. We cannot use cookies or local storage because the requirement is that no actions by the user will restore the modal (such as clearing cookies, sessions, etc.).

My question: what are some options for storing this very basic data set?


Solution

  • I don't think you can store this information only FE side without it being somewhat over-writable.

    The easiest thing I can think about to achieve your request is the following:

    I'd suggest keeping track of this info inside the DB.

    Now, I'm no BE expert, but I'd probably store a simple boolean field for each user, to know wether the user has seen the pop-up up already or not.

    When you load the app, you make the user login, then do an API call to get this info from the backend, and then you handle it however you'd like.

    NOTE that obviously this works only if you have an account system in place. If currently you do not require users to login, I'd probably start with that and then move on to this requirement.

    Also keep in mind that with this solution, a user could create a new account and see again the pop-up.