I am having a problem in props sending in the same component and the function is not function issue coming. So how to solve the issue?
import React, { useState } from 'react';
export default function Lifting() {
const [data, setData] = useState(0);
function globalChange(items) {
setData({ data: items });
}
return (
<div>
<h1>Lifting State Up</h1>
<LiftingChild val={data} onChange={globalChange} />
<br />
<LiftingChild val={data} onChange={globalChange} />
</div>
)
}
function LiftingChild(props) {
return (
<div>
<input value={props.val} onChange={(e) => { props.globalChange(e.target.value) }} />
</div>
)
}