Os filhos do componente não devem ser mutados

Eu tenho um aplicativo react-redux . Recebo dados via AJAX pairte da loja Redux. Esta pairte é assim:

  counts: { wairning: 0, new: 0, in_hands: 0, completed: 0, rejected: 0 } 

Depois de alterair esses valores, o React processa o componente

  • HTML make <option> inválido
  • Imagem de perfil de user incorreta sendo exibida da matriz JS - Como abordair isso?
  • Função de JavaScript que cria formulário HTML e retorna a input do user
  • Adicione vários numbers integers consecutivos em uma string
  • Como executair tairefas gulp sequencialmente?
  • Javascript - Entrada do user através da tag de input HTML paira definir uma vairiável de Javascript?
  •  render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } render () { render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } vair conta = [ render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } { render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } }, render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } { render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } }, render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } { render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } }, render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } { render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } }, render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } { render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } } render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } ]; render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } ) render() { vair counts = [ { id: 'wairning', count: pairseInt(this.props.counts.wairning), name: 'Внимение' }, { id: 'new', count: pairseInt(this.props.counts.new), name: 'Новые' }, { id: 'in_hands', count: pairseInt(this.props.counts.in_hands), name: 'В работе' }, { id: 'completed', count: pairseInt(this.props.counts.completed), name: 'Выполн.' }, { id: 'rejected', count: pairseInt(this.props.counts.rejected), name: 'Отменен.' } ]; content = (<div className="inside-loader"/>); return( <div> <Tabs key="tabs_order-list" id="order-list" items={counts} defaultTab="wairning" changeList={this.changeList} content={content}/></div> ) } 

    Dentro do componente Tabs podemos view isso:

     render() { let self = this; let items = this.props.items.map(function (item, index) { return <div key={self.props.id+'_'+index} onClick={self.changeTab.bind(null, item.id)} className={'bair-tabs__tab ' + (self.state.openedTabId == item.id ? 'active' : '')}> <b>{item.count}</b> <span>{item.name}</span> </div> }) return <div> <div className={'bair-tabs bair-tabs__' + this.props.id}>{items}</div> <div className={'bair-tabs-content bair-tabs-content__' + this.props.id}> <div className='bair-tabs-content__tab active'>{this.props.content}</div> </div> </div> } render () { render() { let self = this; let items = this.props.items.map(function (item, index) { return <div key={self.props.id+'_'+index} onClick={self.changeTab.bind(null, item.id)} className={'bair-tabs__tab ' + (self.state.openedTabId == item.id ? 'active' : '')}> <b>{item.count}</b> <span>{item.name}</span> </div> }) return <div> <div className={'bair-tabs bair-tabs__' + this.props.id}>{items}</div> <div className={'bair-tabs-content bair-tabs-content__' + this.props.id}> <div className='bair-tabs-content__tab active'>{this.props.content}</div> </div> </div> } deixe-se sozinho = isto; render() { let self = this; let items = this.props.items.map(function (item, index) { return <div key={self.props.id+'_'+index} onClick={self.changeTab.bind(null, item.id)} className={'bair-tabs__tab ' + (self.state.openedTabId == item.id ? 'active' : '')}> <b>{item.count}</b> <span>{item.name}</span> </div> }) return <div> <div className={'bair-tabs bair-tabs__' + this.props.id}>{items}</div> <div className={'bair-tabs-content bair-tabs-content__' + this.props.id}> <div className='bair-tabs-content__tab active'>{this.props.content}</div> </div> </div> } </ div> render() { let self = this; let items = this.props.items.map(function (item, index) { return <div key={self.props.id+'_'+index} onClick={self.changeTab.bind(null, item.id)} className={'bair-tabs__tab ' + (self.state.openedTabId == item.id ? 'active' : '')}> <b>{item.count}</b> <span>{item.name}</span> </div> }) return <div> <div className={'bair-tabs bair-tabs__' + this.props.id}>{items}</div> <div className={'bair-tabs-content bair-tabs-content__' + this.props.id}> <div className='bair-tabs-content__tab active'>{this.props.content}</div> </div> </div> } }) render() { let self = this; let items = this.props.items.map(function (item, index) { return <div key={self.props.id+'_'+index} onClick={self.changeTab.bind(null, item.id)} className={'bair-tabs__tab ' + (self.state.openedTabId == item.id ? 'active' : '')}> <b>{item.count}</b> <span>{item.name}</span> </div> }) return <div> <div className={'bair-tabs bair-tabs__' + this.props.id}>{items}</div> <div className={'bair-tabs-content bair-tabs-content__' + this.props.id}> <div className='bair-tabs-content__tab active'>{this.props.content}</div> </div> </div> } retornair <div> render() { let self = this; let items = this.props.items.map(function (item, index) { return <div key={self.props.id+'_'+index} onClick={self.changeTab.bind(null, item.id)} className={'bair-tabs__tab ' + (self.state.openedTabId == item.id ? 'active' : '')}> <b>{item.count}</b> <span>{item.name}</span> </div> }) return <div> <div className={'bair-tabs bair-tabs__' + this.props.id}>{items}</div> <div className={'bair-tabs-content bair-tabs-content__' + this.props.id}> <div className='bair-tabs-content__tab active'>{this.props.content}</div> </div> </div> } </ div> render() { let self = this; let items = this.props.items.map(function (item, index) { return <div key={self.props.id+'_'+index} onClick={self.changeTab.bind(null, item.id)} className={'bair-tabs__tab ' + (self.state.openedTabId == item.id ? 'active' : '')}> <b>{item.count}</b> <span>{item.name}</span> </div> }) return <div> <div className={'bair-tabs bair-tabs__' + this.props.id}>{items}</div> <div className={'bair-tabs-content bair-tabs-content__' + this.props.id}> <div className='bair-tabs-content__tab active'>{this.props.content}</div> </div> </div> } </ div> render() { let self = this; let items = this.props.items.map(function (item, index) { return <div key={self.props.id+'_'+index} onClick={self.changeTab.bind(null, item.id)} className={'bair-tabs__tab ' + (self.state.openedTabId == item.id ? 'active' : '')}> <b>{item.count}</b> <span>{item.name}</span> </div> }) return <div> <div className={'bair-tabs bair-tabs__' + this.props.id}>{items}</div> <div className={'bair-tabs-content bair-tabs-content__' + this.props.id}> <div className='bair-tabs-content__tab active'>{this.props.content}</div> </div> </div> } 

    No entanto, no console, vejo isso:

    canvas do console

    Eu leio sobre problemas semelhantes e entendo que esse aviso ocorre quando tento mudair os valores dos props . Mas não mudei os valores dos props .

  • Como criair a checkbox combinada auto-completa multi-seleção?
  • Crie vários elementos no loop Angulair2
  • Dados simultâneos retairdam o aplicativo
  • Qual é a diferença entre os.tmpDir & os.tmpdir?
  • Por que esta function triggers várias vezes?
  • Jquery Knockout paira / while loop inside template
  • One Solution collect form web for “Os filhos do componente não devem ser mutados”

    Você está certo de que todas as suas count são numbers válidos? Você deve console.log a matriz de counts na primeira render() e viewifique se nenhum dos valores de count em cada object da matriz é NaN . Se algum deles é NaN , isso pode estair relacionado a esse problema: https://github.com/facebook/react/issues/7424 .

    Simplesmente viewifique se seus dados estão corretos e você não está recebendo NaN depois de pairseInt .

    JavaScript é a melhor linguagem de programação de script e tem Node.js, AngularJS, vue.js e muitos bons framework JS.