Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use functional components where possible #154

Open
tbtommyb opened this issue Oct 18, 2018 · 0 comments
Open

Use functional components where possible #154

tbtommyb opened this issue Oct 18, 2018 · 0 comments

Comments

@tbtommyb
Copy link

If you have React components that only call render you can express this more succinctly (and React runs them faster) as a functional component:

const BackButton = ({ link }) => (
  <Link to={link}>
    ...
  </Link>
);

Destructing the props argument is a super-common React pattern that can clean up your code quite a lot.

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

No branches or pull requests

3 participants