styled-jsx
styled-jsx copied to clipboard
feature: `scoped` apply styles to the elements of its parent(s) and children
The
scoped
attribute has been deprecated, they might re-introduce it in future.
Use case
const testComponent = () => {
return (
<>
<header className="card card-header">
<div>
Title
</div>
<Button>
Create
<style jsx scoped>{`
.btn {
width: 200px;
}
`}</style>
</Button>
</header>
<footer className="card card-footer">
<Button>
Big CTA
<style jsx scoped>{`
.btn {
width: 100%;
}
`}</style>
</Button>
</footer>
</>
);
};