Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
ibash
· 1y ago · 0 comments
Modern react developers forget that if statements exist. When react was class based it was trivial to do:
render() { if (this.dontNeedToRender) { return null } }
Now, because hooks can't be skipped, react developers jump through many hoops to use an if statement during rendering.
Comments
[–]
prothy
1y ago
I might be missing your point, can you elaborate? If you want to write an if statement you just do it at the end of a component, after the hooks. It's a common pattern.