Download Latest Version styletron-react@5.0.0 source code.zip (188.7 kB)
Email in envelope

Get an email when there's a new version of styletron

Home / styletron-react@5.0.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2019-05-01 1.4 kB
styletron-react@5.0.0 source code.tar.gz 2019-05-01 153.0 kB
styletron-react@5.0.0 source code.zip 2019-05-01 188.7 kB
Totals: 3 Items   343.0 kB 0

React 16.8 is the minimum supported React version

As Styletron now ships with the useStyletron hook, you need to update your React version to 16.8+.

withStyle aliased to withStyleDeep

Starting the v5 release, the original withStyle functionality got replaced with withStyleDeep. For now, you can still use withStyle, but under the hood, it will simply call withStyleDeep.

$ref got removed

Starting the v5 release, Styletron uses React.forwardRef. If you used $ref in your application, you have to update them to ref.

$style api added

You can now directly override styles of any Styletron component without using the withStyle HoC.

:::jsx
// Static
const Widget = styled("div", {color: "red"});
<Widget $style={{color: "blue"}} />
// result: { color: blue }

// Dynamic
const Widget = styled("div", {color:"red"});
<Widget $style={props => ({color: props.$info ? "blue" : "black"})} $info={true} />
// result: { color: blue }

// $style overrides even the withStyle
const Widget = withStyle(styled("div", {color: "red"}), {color: "yellow"});
<Widget $style={{color: "blue"}} />
// result: { color: blue }
Source: README.md, updated 2019-05-01