我正在使用useContext react hook。
年龄.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
函数组件应以大写开头,将 age 重命名为 Age,以消除错误