Reshade
Installation
yarn add reshade
npm i --save reshade
About
Reshade is a decorator that lets you write isolated styles in your React components.
Simply add the decorator, create a style method and you are good to go!
This project depends on shadow DOM and display: contents. You should not use this package unless your target browsers support these features
Browser support for display: contents
Browser support for shadow DOM v1
Currently this is a good fit for internal applications.
import React Component from 'react'import reshade from 'reshade' @reshade state = fontSize: '1.1rem' { return ` .container { font-size: ; } ` } { const fontSize = etargetinnerHTML this } { return <div ="container"> Selected font size: thisstatefontSize <button =>1rem</button> <button =>2rem</button> </div> }
The shadow root is supplied as a prop.