I am using useContext react hook.
Age.js
import React, { useContext } from 'react' ;
import Detail from '../context/detail';
const age = props =>{
const detail = useContext(Detail);
return(
<p>
Your age is : {detail.age}
</p>
);
}
export default age ;
It gives an error like this :
React Hook "useContext" is called in function "age" which is neither a React function component or a custom React Hook function
Function components should start with uppercase , rename age to Age, to get rid of the error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With