Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is data stored in React.js? [closed]

For an interview, I was asked ,"where is data stored in React.js?" I tried saying state, props, and React doesn't store data. I'm not sure what answer he was looking for. What's the best way to answer this question? Note, he's primarily a Java programmer.

like image 961
user10109 Avatar asked Jan 02 '23 14:01

user10109


2 Answers

Without his mindset it is kinda of hard to say...

  • Hardware - It's stored in memory
  • Classic React - Props and State are completely legitimate answers
  • React-Redux - It's stored in the 'store'

I think this is a poor question to ask an interviewee without any real context. Java programmer or not, it sounds like he doesn't entirely understand what he is talking about. You might have dodged a bullet not working for that company.

like image 91
John Avatar answered Jan 05 '23 03:01

John


I would have said React can use a combination of sessionStorage, localStorage, state, store, and this, to hold data, however storing data would be whatever database you setup to use it with.

like image 35
Darin Jacobson Avatar answered Jan 05 '23 03:01

Darin Jacobson