Cannot update during an existing state transition (such as within `render` or another component's constructor). Render methods should be a pure function of props and state; constructor side-effects ar

react报这个错误的原因就是说不能再render的时候改变state的值

遇到这种情况怎么办


毫不犹豫的使用这个方法,在这里面进行更新就不会有这种问题

你可能感兴趣的:(Cannot update during an existing state transition (such as within `render` or another component's constructor). Render methods should be a pure function of props and state; constructor side-effects ar)