我正在使用 useContext react-hooks。
时代.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 ;
它给出了这样的错误:
React Hook "useContext" is called in function "age" which is neither a React function component or a custom React Hook function