Skip to content

Instantly share code, notes, and snippets.

@ericelsken
Created March 3, 2017 16:41
Show Gist options
  • Save ericelsken/7928df35fc9f28f8253a1d3bc0d25827 to your computer and use it in GitHub Desktop.
Save ericelsken/7928df35fc9f28f8253a1d3bc0d25827 to your computer and use it in GitHub Desktop.
import React, { Component, PropTypes } from 'react';
export default class ClientDashboard extends Component {
static propTypes = {
clientId: PropTypes.string.isRequired,
client: PropTypes.object,
fetchClient: PropTypes.func.isRequired,
}
componentWillMount() {
this.props.fetchClient(this.props.clientId);
}
componentWillReceiveProps(nextProps) {
if (this.props.clientId !== nextProps.clientId) {
this.props.fetchClient(nextProps.clientId);
}
}
render() {
//return something displaying this.props.client.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment