【发布时间】:2020-02-03 14:34:35
【问题描述】:
我正在使用 useContext 反应钩子。
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 ;
它给出一个 错误 像这样:
React Hook "useContext" is called in function "age" which is neither a React function component or a custom React Hook function
【问题讨论】:
标签: javascript reactjs react-hooks