setState() or markNeedsBuild called during build

class MyHome extends StatefulWidget { @override State<StatefulWidget> createState() => new MyHomePage2(); } class MyHomePage2 extends State<MyHome> { List items = new List(); buildlist(String s) { setState(() { print(“entered buildlist” + s); List refresh = new List(); if (s == ‘button0’) { refresh = [ new Refreshments(“Watermelon”, 250), new Refreshments(“Orange”, 275), new Refreshments(“Pine”, 300), new Refreshments(“Papaya”, … Read more

ReactJS: Warning: setState(…): Cannot update during an existing state transition

I am trying to refactor the following code from my render view: <Button href=”#” active={!this.state.singleJourney} onClick={this.handleButtonChange.bind(this,false)} >Retour</Button> to a version where the bind is within the constructor. The reason for that is that bind in the render view will give me performance issues, especially on low end mobile phones. I have created the following code, … Read more

Can I execute a function after setState is finished updating?

I am very new to ReactJS (as in, just started today). I don’t quite understand how setState works. I am combining React and Easel JS to draw a grid based on user input. Here is my JS bin: http://jsbin.com/zatula/edit?js,output Here is the code: var stage; var Grid = React.createClass({ getInitialState: function() { return { rows: … Read more

Can’t perform a React state update on an unmounted component

Problem I am writing an application in React and was unable to avoid a super common pitfall, which is calling setState(…) after componentWillUnmount(…). I looked very carefully at my code and tried to put some guarding clauses in place, but the problem persisted and I am still observing the warning. Therefore, I’ve got two questions: … Read more