Skip to content

Conditional for rendering #357

Answered by ryansolid
visj asked this question in Q&A
Mar 3, 2021 · 10 comments · 2 replies
Discussion options

You must be logged in to vote

Ok not promising this is super optimized but I think I recreated the logic: https://codesandbox.io/s/ivi-example-zsopf?file=/index.js. Using indexes in <For> actually adds a memory overhead that I optimize out when not required. And <Switch> <Match> is likely not the most optimal way to do the conditional logic but it is definitely the easiest.

That all being said make sure you are testing the same thing. Keyed, vs non-keyed makes a big difference and I can't tell from the code if ivi is doing keyed or not.

I do suspect there will be overhead here as this example is pretty complicated logic-wise and the benchmark is basically doing snapshots so there is almost no benefit to even diffing. …

Replies: 10 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ryansolid
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@ryansolid
Comment options

@visj
Comment options

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
Converted from issue

This discussion was converted from issue #356 on March 05, 2021 19:09.