3 ms·
For data to rendering on UI, JSON.parse(JSON.stringify()) is enough. For other operations, clone an object with such complex structure is not a good idea, you
by shanghaikid 3y ago
For data to rendering on UI, JSON.parse(JSON.stringify()) is enough.
For other operations, clone an object with such complex structure is not a good idea, you may change your way of coding.
- noduerme 3y agoAgreed, generally. But it may be nice for saving complicated game states, or sending complicated objects to a Worker without having to rebuild them from JSON.