// Parent import Child from './Child'; function App() { const pull_data = (data) => { console.log(data); // LOGS DATA FROM CHILD (My name is Dean Winchester... &) } return ( <div className='App'> <Child func={pull_data} /> </div> ); } export default App; // Child const Child = (props) => { props.func('My name is Dean Winchester & this is my brother Sammie'); return ( <> <h1>I am the Child Component!</h1> </> ); } export default Child;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter