<div id="root"></div>
import React from 'https://cdn.skypack.dev/react';
import ReactDOM from 'https://cdn.skypack.dev/react-dom';

const {useState} = React;

function Parent (){
  const [state,setState] = useState(0);
  return <div>
    <p>count: {state}</p>
    <button onClick={()=>{setState(c=>c+1)}}>Increment</button>
    <Child state={state}/>
  </div>
}

function Child({state}){
  state = state+5; 
  return <div><p>count + 5 = {state} </p></div>
}

ReactDOM.render(<Parent/>,document.getElementById("root"))
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.