DEV Community

Discussion on: A Clean Way to Conditionally Render Components

 
lukaselmer profile image
Lukas Elmer • Edited

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