1

making a website while learning the reactjs and firebase

I am very new to reactjs and firebase. I thought best way to learn them is do a project while learning them.Here my question is how can I use below javascript part in reactjs.

actionCodeSettings = {
    // After password reset, the user will be give the ability to go back
    // to this page.
    url: "http://localhost:3000/logs#/react-auth-ui/sign-in",
    handleCodeInApp: false
  }

I tried as below

constructor() {
super();
this.state = {
  email: "",
  isOpen: false,
  actionCodeSettings = {
    // After password reset, the user will be give the ability to go back
    // to this page.
    url: "http://localhost:3000/logs#/react-auth-ui/sign-in",
    handleCodeInApp: false
  }
};
this.handleChangeEmail = this.handleChangeEmail.bind(this);

this.handleSendPasswordResetEmail = this.handleSendPasswordResetEmail.bind(
  this
);

}

any help is appreciated. Thanks

Dinithi
  • 518
  • 5
  • 17

1 Answers1

2

this.state is just an object. It follows the following syntax:

this.state = { key1: val1, 
               key2: val2 }

So simply replace = with a : there

this.state = {
  actionCodeSettings : {
    url: "http://localhost:3000/logs#/react-auth-ui/sign-in",
    handleCodeInApp: false
  }
};
shinite
  • 1,978
  • 3
  • 12
  • 15
  • 1
    In addition to this, please also check this question: https://stackoverflow.com/questions/43040721/how-to-update-nested-state-properties-in-react It tells more about how to update the state when you use a nested object like this, but it gives also a reason why you might not want to do this. See four yourself – n9iels Apr 04 '19 at 19:06