Sometimes styles can be quite long and it makes sense for them to live in a seperate file. For example, if you are using next.js and you want to put your styles in a ./styles.js file next to a component (minimal styling just for the example):
export default `
p {
color: red;
}
`
Then import it:
import styles from './styles';
export default () => (
<div>
<p>only this paragraph will get the style :)</p>
<style jsx>{styles}</style>
</div>
)
Will give you the following error: Module build failed: SyntaxError: Expected a template literal or String literal as the child of the JSX Style tag (eg: <style jsx>{some css}</style>), but got Identifier.
Sometimes styles can be quite long and it makes sense for them to live in a seperate file. For example, if you are using next.js and you want to put your styles in a
./styles.jsfile next to a component (minimal styling just for the example):Then import it:
Will give you the following error:
Module build failed: SyntaxError: Expected a template literal or String literal as the child of the JSX Style tag (eg: <style jsx>{some css}</style>), but got Identifier.