<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({count:0});
  return <div>
    <p>count: {state.count}</p>
    <button onClick={()=>
        setState( c=>{return {count:c.count+1}} ) 
      }>Increment</button>
    <Child state={state}/>
  </div>
}

function Child({state}){
   const stateClone = {...state}
   stateClone.count= stateClone.count+5;
  return <div><p>count + 5 = {stateClone.count} </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.