deleting object properties doesn't trigger a render
See original GitHub issueMaybe this has been discussed at some point, maybe not, but I was surprised that
obj.b = 'foo';
…will trigger a re-render, but…
delete obj.b;
…won’t.
REPL: https://svelte.dev/repl/c5377d8c85e34735a792a29e1b2d1353?version=3.6.6
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:22 (12 by maintainers)
Top Results From Across the Web
setState does not trigger render after item deleted from object
In my app you can set an age restriction on a link. If there is an age restriction on the link will it...
Read more >Removing Object Properties with Destructuring
Before destructuring, we would typically use the delete keyword to remove properties from an object. The issue with delete is that it's a...
Read more >When does React re-render components? - Felix Gerschau
Directly mutating the props object is not allowed since this won't trigger any changes, and React doesn't notice the changes.
Read more >5 things you need to know about the delete operator in ...
The delete operator removes a property from an object. It cannot delete a variable. Any property declared with var cannot be deleted from ......
Read more >React.useEffect Hook – Common Problems and How to Fix ...
Most developers have gotten pretty comfortable with how they work and ... We are actually creating a new object every time we re-render...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think the simplest approach is
=
sign will trigger an update.After completing the tutorial a few weeks ago, the rules in the back of my head were:
To me it’s more logical to group the different behaviors based on the fact that
1)
are method calls,2)
are not.I’m not going to die on this hill, but just wanted to point this out as being the more logical approach in my opinion.