1

New to react js, redux and express.

I've made a simple login / register application using react js, redux, webpack and express. Currently the views / components are created and working.

I need to be able to store users information, "email" and "password" is all that's required to register.

Are there any examples of this I could look at implementing into my solution?

5
  • Do you want to store these information in a Database, or Session (Backend), or have them available in the frontend in your react app ? Commented May 25, 2016 at 9:56
  • If possible to have them available in the frontend in the react app Commented May 25, 2016 at 9:58
  • Is it better for me to use a database like MongoDB? Commented May 25, 2016 at 9:59
  • It's personal preference. Use what you want. I personally use mysql. Commented May 25, 2016 at 10:09
  • If my answer helped you, accept it as an answer so other people also know it worked :) Commented May 27, 2016 at 6:33

1 Answer 1

1

I am not exactly sure if this is what you are looking for but you could do the following in your react component:

NOTE this is only an example how to do it without isomorphic javascript

...
componentDidMount(){
  this.getUserInitData()
}
...
getUserInitData(){
  // here you make a simple AJAX request to the server to get the data
  $.get('/api/get/user/init', function(result){
     console.log(result)
     // now result contains whatever information your server will respond with
     // this could be your user authentication data for example.
     // Now you can go ahead and store the result into your state
  });
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.