Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Alternative to #10746, so that we can tidy up the PR queue. I still think we're devoting way too much space to
$effect
in these docs, but if we must keep a section on shallow tracking then we can at least whittle it down a bit.Currently, the comments (which are the important bit) are the least visible part of the section — there's too much visual noise surrounding them (both literally, in that they're inside the
$effect
blocks, and in the sense of being less prominent than theconsole.log
calls in terms of syntax highlighting). Moving them out of the blocks, putting them all on a single line, and getting rid of theconsole.log
calls helps a lot, I think. I also think that removing the distracting logs makes it clearer that reading a value (even if you don't 'do' anything with it) is what makes something a dependency of an effect.We should avoid using
snake_case
in snippets like these unless we plan to commit to using it everywhere in docs, which I don't think we're ready to do. When dealing with abstract concepts I think short names likea
andb
rather thanobject
andderived_object
tend to work better.