Skip to content

Documentation and ESLint inconsistencies #363

Closed Answered by dai-shi
webcodion asked this question in Q&A
Discussion options

You must be logged in to vote

shouldn't it be "...from snapshot"?

Oh, yes! You are right.

What do I have to watch out for?

Hm, good point. [obj.a, obj.b] in deps is not preferred in React in general, because it can be changed? (I guess eslint rules warn this, but maybe it's improved?)
But in valtiosnap is a frozen object, so there would be no pitfalls.

const machines = useMemo(() => { ... }, [machineConfig])

There's a pitfall with this usage. If you touch machineConfig.foo in the same render function. It will not work as expected.

add a useEffect() and useMemo() example to your documentation

Yeah, that's a valid suggestion.
But, not sure what to suggest for certain.
The recommended pattern for useEffect is:

us…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@webcodion
Comment options

@webcodion
Comment options

@webcodion
Comment options

@webcodion
Comment options

@dai-shi
Comment options

Answer selected by webcodion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants