Last active
December 12, 2017 16:53
-
-
Save maecapozzi/551eb37ea0590166649da7de9a75a1c4 to your computer and use it in GitHub Desktop.
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
// App.js | |
import React, { Component } from 'react' | |
import Parent from './Parent' | |
import './App.css' | |
class App extends Component { | |
handleClick () { | |
throw new Error('This is an error') | |
} | |
render () { | |
return ( | |
<div className='App'> | |
<Parent handleClick={this.handleClick.bind(this)} /> | |
</div> | |
) | |
} | |
} | |
export default App | |
// Parent.js | |
import React from 'react' | |
import Child from './Child' | |
const Parent = props => ( | |
<div> | |
<h1>Parent</h1> | |
<Child handleClick={props.handleClick} /> | |
</div> | |
) | |
export default Parent | |
// Child.js | |
import React from 'react' | |
const Child = props => ( | |
<div> | |
<h3>Child</h3> | |
<button onClick={props.handleClick}>Click Me</button> | |
</div> | |
) | |
export default Child | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment