小编max*_*new的帖子

使用Relay和GraphQL进行查询

我正在学习React + Relay + GraphQL教程@ https://facebook.github.io/relay/docs/tutorial.html

我对于什么接口感到困惑:[nodeInterface]在GraphQL对象定义中做了什么.

reactjs graphql relayjs

6
推荐指数
2
解决办法
1073
查看次数

React不会在状态更改时重新呈现

单击按钮时,我正在渲染新表单.所以基本上我改变了组件中的状态:

false为true或null为true

但是,奇怪的是,组件在状态更改后不会重新呈现

export default class BoardManager extends React.Component{
   constructor(){
    super();
    this.state = {
      newForm : null
    };
    setTimeout(() => {
      this.state = {
        newForm : true
      };
      console.log(this.state.newForm);
    },1000);
  }

  render(){
    return(
      <div>
        Some thing here
        {this.state.newForm ? <NewBoardForm />: null}
      </div>
    )
  }
} 
Run Code Online (Sandbox Code Playgroud)

非常感谢!!!

编辑!!!解

export default class BoardManager extends React.Component{
  constructor(){
    super();
    this.state = {
      newForm : null
    };
  }

  render(){
    return(
      <div>
        <BoardsTable boards={BoardData.boards}/>
        <button onClick={() => {
            this.setState({
              newForm : true
            });
            console.log(this.state.newForm);
          }}>Add …
Run Code Online (Sandbox Code Playgroud)

reactjs

4
推荐指数
2
解决办法
9417
查看次数

标签 统计

reactjs ×2

graphql ×1

relayjs ×1