Search This Blog

Styling React App with Emotion

  • Install Emotion packages into your React App by running the command inside the React project directory:
    npm install --save @emotion/react @emotion/styled
  • Add following to tsconfig.json
    {
      "compilerOptions": {
        ...
        "jsx": "react-jsx",
        "jsxImportSource": "@emotion/react",
        ...
      }
    }
  • At the top of your .tsx file, insert line:
    /** @jsxImportSource @emotion/react */



see also

No comments:

Post a Comment