Default is not my concern at all, it can be replaced with case 'guest'. My problem is using an enum:
with component definitions (foo: <Bar />): it has performance costs
with direct component values (foo: Bar): it sacrifices flexibility and maintainability.
The last example you wrote is also an anti-pattern I explained.
As a hint, this code snippet alone here should be a red flag in the 90% of the cases: <Component {...props} />. By seeing the code you don't know what your component exactly is, and what props it is getting. This could be the equivalent of TS's any in React.
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.
Default is not my concern at all, it can be replaced with
case 'guest'
. My problem is using an enum:foo: <Bar />
): it has performance costsfoo: Bar
): it sacrifices flexibility and maintainability.The last example you wrote is also an anti-pattern I explained.
As a hint, this code snippet alone here should be a red flag in the 90% of the cases:
<Component {...props} />
. By seeing the code you don't know what your component exactly is, and what props it is getting. This could be the equivalent of TS's any in React.