The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Increasing reusability with React container components

Increasing reusability with React container components

4:32
You can increase reuse in your codebase by dividing your components into containers and content, or as some people call them, smart and dumb components. This lesson walks through a very simple refactoring to demonstrate this concept and show you how to maximize the portability of your React components.
Watch this lesson now
Avatar
egghead.io

You can increase reuse in your codebase by dividing your components into containers and content, or as some people call them, smart and dumb components. This lesson walks through a very simple refactoring to demonstrate this concept and show you how to maximize the portability of your React components.

Avatar
Nishan Lakmal

why do we need to sign 'success' function ?

success: function(data) {
this.setState({
people: data.results.map(res => res.user)
});
}.bind(this)

In reply to egghead.io
Avatar
Ben

I assume you mean bind rather than sign. Without the call to bind, the function would be called in the context of jQuery, not our PersonListContainer class, and we wouldn't be able to call this.setState().

In reply to Nishan Lakmal
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?