10
rated 0 times
[
17]
[
7]
/ answers: 1 / hits: 6936
/ 4 Years ago, mon, february 3, 2020, 12:00:00
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
More From » reactjs