After some searching found that
JSON object can create a detached copy of an object, which then wont change the data as the state changes.
this.prevData=JSON.parse(JSON.stringify(this.state.data))
There are multiple ways of creating copies this seems easier to understand.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…