skip to Main Content

I’m developing the application in NextJS with MongoDB. This app features a list of tasks with checkboxes and buttons. If the user selects the correct combination of checkboxes, they receive a score of 1.

The question is: Where should I store the score?

One option that comes to mind is to use local storage for a quick response and to avoid a lot of requests to the DB.

The second one: when the user completes a task and earns a score, send a request to API endpoint to store the score directly in the database.

2

Answers


  1. for me the best way is to store it using redux that will allow you to keep the response as fast as possible during the session
    while updating the slice content in the redux after user leave the update or edit list upload it to the db
    and any time user re visit the website fetch the data and store it in the redux slice

    Login or Signup to reply.
  2. If You have to process it, then store it in database otherwise you won’t be able to retrieve it later

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search