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
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> | |
); |
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
import ReactDOM from 'react-dom'; | |
import Post from './Post'; | |
ReactDOM.render( | |
<Post postId="1" /> , | |
document.getElementById('root') | |
) |
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
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 = {}; | |
} | |
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
const UppercaseHoC = (WrappedComponent) => (props) => | |
<div style="text-transform: uppercase;"> | |
<WrappedComponent {...props}/> | |
</div> |
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
const Greeting = (props,context) => <p style={context.style}>Hello World</p> | |
Greeting.contextTypes = { | |
color: React.PropTypes.string, | |
backgroundColor: React.PropTypes.string, | |
} |
NewerOlder