diff --git a/Programming_Languages/Frameworks/React/Hooks/Child_to_parent_data_flow.md b/Programming_Languages/Frameworks/React/Hooks/Child_to_parent_data_flow.md index 93a5e7a..081a9ec 100644 --- a/Programming_Languages/Frameworks/React/Hooks/Child_to_parent_data_flow.md +++ b/Programming_Languages/Frameworks/React/Hooks/Child_to_parent_data_flow.md @@ -12,3 +12,25 @@ Despite React having a uni-directional, downwards data-flow, it is sometimes nec For the example we will use the standard click incrementer. We have a counter on the parent that is updated in response to a click event in the child component. + +Our parent component is `App` and the child component is `Child` + +```jsx +export default function App() { + const [count, setCount] = useState(0); + return ( + <> +
{count}
+