1
0

More than 1 year has passed since last update.

found page without a React Component as default export in がでたときの解決方法

Posted at

ググってると、
export default しろ。ってでてくるんですけど、いやしてるんですけど・・・って感じで結構ハマりました。

結論としては、 pages配下に、themeファイルをおいてしまっていた からでした。

nextjsの特性上、pages配下はいわゆるページになるわけで、それらはreact componentでなければならないようです。

僕は何がreact componentで、何がreact componentじゃないのかとかはよくわからないんですけども。
少なくともthemeファイルは違うようです。

というわけで、pages配下にあったthemeを、別の場所に移動させることで解決しました。

エラーメッセージをよく見ると、

See https://nextjs.org/docs/messages/page-without-valid-component for more info.

とでています。

そこをよく見ると、

If the file is not meant to be a page, and instead, is a shared component or file, move the file to a different folder like components or lib.

がっつりかかれてました。
めでたしめでたし。。。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0