'How to pass state from child to parent in a function React
i'm new to react, and i'm trying to pass data between two functional component without using any events handler like (onClick or onChange) In my child component
const Child = () => {
const [data, setData] = useState([]);
useEffect(() => {
fetchData().then(result => setData(result.dataArray));
}, []);
}
function App() {
return(
<Child />
)
}
For any Suggestions and help i will be grateful
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
