There is such local function (in functional component with state provided useState hook) that has a deal with the state
      let setContainer = container => {
        let newState = {...state, files: deleteAllFromTo(state.files), container}
        let newStateIntermediate = JSON.parse(JSON.stringify(newState))
    
        console.log('-----------------')
        console.log(newState)
        console.log(newStateIntermediate)
        setState(newStateIntermediate)
      }
Why the newState and newStateIntermediate are able to be different?

 
    