Closed Liuyll closed 4 years ago
If autofreeze is enabled, all plain objects in the tree will automatically be frozen, this includes react component instances. So this will break react itself that assumes it can modify the internal state of the element.
Some fixes for this issue would be:
immerable
from immer, and setting: action.children[immerable] = false
react element is not extensible so i cant setting action.children[immerable] = false
but i fix the issue by turn off autoFreeze
. thanks help very much
Another option to solve this is to React.cloneElement
at render time.
š Bug Report
in react reducer hooks,i get a fatal error in process of using immer... i cant find relevant error ...
question:
var definite
this is reducer
in this way render :
occured error
Uncaught TypeError: Cannot assign to read only property 'validated' of object '#<Object>'
but I toggle the reducer in next:
this can work ...
or i toggle this way to render:
Link to repro
https://github.com/Liuyll/minimal-repro
Environment
setUseProxies(true)