Skip to main content
1 de 3
Diego
  • 5
  • 1
  • 4

Hi, I'm just learning react.js and I'm creating a "task list" and it appears: "Error: Maximum update depth exceeded"

import React from 'react'; import './App.css';

import List from './Components/List'; import TaskForm from './Components/TaskForm';

import TaskList from './Sample/TaskList.json' class App extends React.Component{

state = { taskLists: TaskList }

addTask = (title,description) => { const newTask = { title: title, description: description, id: this.state.taskLists.length } this.setState({ taskLists : [...this.state.taskLists, newTask] }) }

render(){ return( ); } }

export default App;

Diego
  • 5
  • 1
  • 4