Next.jsでコンポーネントを作って、別のコンポーネントで展開させようとしたところ
Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
のようなWarningが出てしまい、展開できません。
Reactをやっていて初めて出た現象です。
以下、どこか間違っていますでしょうか?
子コンポーネント
tsx
1import { FC } from 'react'; 2export const Button: FC = () => { 3 return ( 4 <>Button予定地</> 5 ); 6}
親コンポーネント
tsx
1import { FC } from 'react'; 2import { Button } from '../components/Button/Button'; 3 4const Index: FC = () => { 5 return ( 6 <>{ Button }</> 7 ); 8} 9 10export default Index;
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。