Skip to content

Instantly share code, notes, and snippets.

@Mohammad-Faisal
Last active April 2, 2023 14:05
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Mohammad-Faisal/c1c39a4b32a206cfd7a6c78226c702bf to your computer and use it in GitHub Desktop.
Save Mohammad-Faisal/c1c39a4b32a206cfd7a6c78226c702bf to your computer and use it in GitHub Desktop.
const {role} = user
const components = {
ADMIN: AdminUser,
EMPLOYEE: EmployeeUser,
USER: NormalUser
};
const Component = components[role];
return <Componenent />;
@rajeshstarlite
Copy link

Hello @Mohammad-Faisal

Thanks for amazing ReactJS best practices. I think in above example there is typo. <Componenent /> should be <Component />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment