我可以在reactjs中通过一个变量包装多个变量

时间:2019-04-04 18:55:50

标签: reactjs firebase

在学习reactjs和firebase的同时建立网站

我对Reactjs和Firebase还是很陌生。我认为学习它们的最好方法是在学习它们的同时做一个项目。这是我的问题是如何在reactjs的javascript部分下面使用。

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
  }

我尝试如下

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
);

}

这可能是一个愚蠢的问题。但是我的reactjs情况现在是这样,我想提高自己。任何帮助我们都感激不尽。谢谢

1 个答案:

答案 0 :(得分:1)

this.state只是一个对象。它遵循以下语法:

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

所以只需将=替换为:在那里

this.state = {
  actionCodeSettings : {
    url: "http://localhost:3000/logs#/react-auth-ui/sign-in",
    handleCodeInApp: false
  }
};