LoginSignup
0
0

More than 1 year has passed since last update.

Reactのエラー回避まとめ

Last updated at Posted at 2022-07-06

1.JSX expressions must have one parent element.ts

const App = () => {
  return (
      <h1>React</h1>
      <h1>エラーが出る</h1>
  );
};

JSXの要素は一つのタグで囲まなければいけない。ただエラー回避したいだけならこれでOK

const App = () => {
  return (
    <>
      <h1>React</h1>
      <h1>エラー回避</h1>
    </>
  );
};

2.'msg' is declared but its value is never read.

const msg = () => {
  return <p>エラー出る</p>;
};

ユーザー定義のコンポーネントは大文字で始める

const Msg = () => {
  return <p>エラー回避</p>;
};
0
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
0
0