Skip to content

Instantly share code, notes, and snippets.

View codeocelot's full-sized avatar

Joey Gracey codeocelot

View GitHub Profile
import React from 'react';
import PropTypes from 'prop-types';
import AsyncPostHoC from '...';
const PostView = (props) => (
<div>
<p>{props.title}</p>
<p>{props.body}</p>
</div>
);
import ReactDOM from 'react-dom';
import Post from './Post';
ReactDOM.render(
<Post postId="1" /> ,
document.getElementById('root')
)
import React from 'react';
import PropTypes from 'prop-types';
const route = 'https://jsonplaceholder.typicode.com/posts';
class AsyncPostHoC extends React.Component{
constructor(props){
super(props);
this.state = {};
}
@codeocelot
codeocelot / UppercaseHoC.js
Last active April 29, 2017 21:03
Higher Order Component to uppercase text
const UppercaseHoC = (WrappedComponent) => (props) =>
<div style="text-transform: uppercase;">
<WrappedComponent {...props}/>
</div>
const Greeting = (props,context) => <p style={context.style}>Hello World</p>
Greeting.contextTypes = {
color: React.PropTypes.string,
backgroundColor: React.PropTypes.string,
}