Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@astrotim
Last active December 29, 2017 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astrotim/f4447d16b25f8707655f1b31ffb384fa to your computer and use it in GitHub Desktop.
Save astrotim/f4447d16b25f8707655f1b31ffb384fa to your computer and use it in GitHub Desktop.
update Post.js to render content
render() {
- console.log(this.state.data);
- return <p>Post</p>;
+ if (!this.state.data) return null;
+
+ return (
+ <React.Fragment>
+ <h1>{this.state.data.title}</h1>
+ {this.state.data.content}
+ </React.Fragment>
+ );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment