Skip to content
All lessons

Tech Insights· twitter.com

Rendering React component based on some string enum

From twitter.com

⚛️ React tip: when conditionally rendering component based on some string enum (like a role), use an object to map enum values to components. This can be cleaner than using conditional operators, and it keeps the logic organized & clear.

Shared by

Read on twitter.com
  • React

Book a call

Lessons like this one
shape how we build.

Tell us what you’re building. In one call, we’ll show you how our team would approach it.

Tell us what you’re building, and we’ll show you how we’d approach it.

Still prefer the good old email? Contact us