-
-
Save edrpls/1ae73fc539e315cf3bcdc7cb6f8fbf87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Clients.jsx | |
import React from 'react'; | |
class Clients extends React.Component { | |
// Request the server data | |
componentDidMount() { | |
this.props.getClients(); | |
} | |
_reverseOrder = () => this.props.toggleSorting(); | |
render() { | |
return ( | |
<div> | |
<button type="button" onClick={this._reverseOrder}> | |
Reverse order | |
</button> | |
<ul> | |
{/* We now use the clients array that comes from the props */} | |
{this.props.clients.map(client => <li key={client.id}>{client.name}</li>)} | |
</ul> | |
</div> | |
); | |
} | |
} | |
export default Clients; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment