DEV Community

Discussion on: Conditionally render react components in cleaner way

Collapse
 
thomasburleson profile image
Thomas Burleson • Edited

Enums are very powerful and restrict the keys that can be used.
For clarity, the roleSettings function returns a hashmap (key/value pairs). It is not an enum.

Thx for sharing two cool approaches to conditional renderings.
To validate the userRole and provide a fallback to guest, I recommend this: