Yes, the statement in <If/> will be evaluated, but I feel it is minor problem that can be avoid, for example, enclosing the statement inside the child component.
Beside the performance issue, this can be an issue if you check in the condition a precondition for the rendering (e.g. if an object exists), and in the rendering part you depend on this check (e.g. access properties of this object).
E.g. let post: Post | undefined
Check in the condition if post !== undefined
Render post.title if the condition is true
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yes, the statement in
<If/>
will be evaluated, but I feel it is minor problem that can be avoid, for example, enclosing the statement inside the child component.Thanks for point this out!
Beside the performance issue, this can be an issue if you check in the condition a precondition for the rendering (e.g. if an object exists), and in the rendering part you depend on this check (e.g. access properties of this object).
E.g.
let post: Post | undefined
Check in the condition if
post !== undefined
Render
post.title
if the condition is true