Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am josemussa on github.
  • I am mussa (https://keybase.io/mussa) on keybase.
  • I have a public key ASCp1A1yXxEw5-X7OYCX_14gVxA3av5RATauSVqEMNJ5ugo

To claim this, I am signing this object:

@josemussa
josemussa / gist:5f4bc74d66493c035347b6120f12d4cf
Created August 27, 2018 08:33
Avoid renderThing methods
### Avoid renderThing methods
If you’ve defined a custom method in your component that starts with the word render, chances are that should be its own component. As (Chris Biscardi)[https://mobile.twitter.com/chrisbiscardi/status/1004559213320814592] puts it, “[It] effectively means there’s enough complexity to be worth breaking down”. React’s smart about when to render or not render a component, so by splitting these out into their own components, you can help React do its job better.
```JS
// Instead of this
class Items extends React.Component {
renderItems ({ items }) {
return items.map(item => (
<li key={item.id}>