Skip to content

Instantly share code, notes, and snippets.

@maecapozzi
Last active December 12, 2017 16:53
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 maecapozzi/551eb37ea0590166649da7de9a75a1c4 to your computer and use it in GitHub Desktop.
Save maecapozzi/551eb37ea0590166649da7de9a75a1c4 to your computer and use it in GitHub Desktop.
// 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