Skip to content

Instantly share code, notes, and snippets.

View ZanshinPost's full-sized avatar

Zanshin ZanshinPost

View GitHub Profile
@ZanshinPost
ZanshinPost / render-logic.js
Created December 3, 2017 16:08 — forked from markerikson/render-logic.js
React render function organization
class ParentComponent extends Component {
render() {
// My basic render function structure:
// 1) Extract values from props and state
const {a, b, someBoolean, someList} = this.props;
// 2) Render any dependent items into temporary variables, such as conditional components or lists
const conditionalComponent = someBoolean ? <SomeComponent /> : null;
const listItems = someList.map(item => <ListItem item={item} />);