question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I make the answers to the survey persist with react and redux?

See original GitHub issue

What is the current behavior?

The issue/question: Suppose the user enters male for a question with a radio button, then goes to another page and comes back to the survey, the radio button for male is no longer selected.

My current solution: I am storing the answers in redux and passing the answers in the react component with the data prop like this:

<Survey
   data={ props.questions[props.page].answers}
  ....
  ....
/>

Where the prop I am passing in is the answers object of key value pairs. Am I doing this the proper way?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dmitrykurmanovcommented, Aug 25, 2017

@john1625b, I’ve created branch “redux” in on our quick_start_repo. Could you please check it?

0reactions
dmitrykurmanovcommented, Nov 29, 2017

@john1625b, yes thank you! I’ve lost it 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redux/React-Redux and Redux-Persist only persisting first ...
You can add one first parameter more, to create a new object that will have the state properties with the new foo one:...
Read more >
Persist state with Redux Persist using Redux Toolkit in React
Let's learn how to use Redux Persist to save the state in persistent storage so that even after a refresh, the data will...
Read more >
Persist data with Redux · Issue #10 - GitHub
My question is , how can I preload those answers?, in the event that the user answers 50% of the survey, how can...
Read more >
Redux-persist: The Good Parts. Using the logger ... - codeburst
Persisting state across sessions perceives as simple but is actually dreadfully complicated. The number of edge cases regarding the user and how they...
Read more >
Build Quiz App with ReactJS and Redux - YouTube
We are gonna use reactJs, Redux, and for the API we use Open Trivia, we also learn how to create custom hooks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found