I am encountering an issue while attempting to import createGlobalStyle from styled-components. Despite having installed the styled-components npm package with version @3.4.10, it doesn't seem to work as expected.
const GlobalStyle = createGlobalStyle`
html {
height: 100%
}
* {
padding: 0;
margin: 0
}
`
export default GlobalStyle
The snippet above shows where I am trying to import createGlobalStyle.
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
import GlobalStyle from './theme/globalStyles'
ReactDOM.render(
<React.StrictMode>
<App />
<GlobalStyle />
</React.StrictMode>,
document.getElementById('root')
)
This is the index.js file where I make use of the GlobalStyle component.
Upon running the code, I encountered the following error:
./src/theme/globalStyles.js
Attempted import error: 'createGlobalStyle' is not exported from 'styled-components'.
If anyone could offer some guidance or pointers on this matter, it would be greatly appreciated.