10.0.7 not working with Create React App
See original GitHub issueemotion
version: 10.0.7react
version: 16.8.1
Relevant code:
import { jsx, css } from '@emotion/core'
const CloseButton = ({ onClick, children }) => (
<button css={css`
background: red;
`}
onClick={() => onClick()}>
{ children }
</button>
)
What you did:
- Created a new project with
Create React App
. - Installed Emotion
- Tried to use
css
What happened:
It renders [object Object]
:
<button class="[object Object]">Close</button>
Reproduction: https://codesandbox.io/s/7k11o3q1q1
Problem description: I may be missing something here… Every example I find in the docs makes it seem this simple, but I can’t seem to get it working with CRA. See example (https://codesandbox.io/s/7k11o3q1q1). Maybe an issue with CRA’s implementation of babel, and the dependencies of emotion?
Suggested solution:
It’d be nice to get an error instead of just [object Object]
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Create React App not working - Stack Overflow
1. update the npm version (npm install npm@latest -g) · 2. clear the cache (npm cache clean --force) · 3. create the react...
Read more >create-react-app - npm
Create React apps with no build configuration. ... Start using create-react-app in your project by running `npm i create-react-app`.
Read more >create-react-app - CodeSandbox
CodeSandbox is an online editor tailored for web applications.
Read more >Npm install problem when creating my first react app
npm ERR! network request to http://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND proxy.company.com
Read more >How to Install and Setup a React App on Windows 10
Running the Application. So the app we created can run locally on our system with the npm start command. cd awesome-project npm start....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Not according to the docs (https://emotion.sh/docs/css-prop). 😞
You have to add this code snippet (from: https://emotion.sh/docs/install) at the top before you import,
/** @jsx jsx */