0.6.2 • Published 4 years ago

react-otion v0.6.2

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

react-otion

Server-side React bindings for otion, the atomic CSS-in-JS library.

Usage

Install the library and its bindings with a package manager of choice, e.g.:

npm install otion react-otion

Server-side rendering

A special renderer is available for instantiating <style> JSX elements on the server, as seen in the Next.js example:

import { setup } from "otion";
import { getStyleElement, VirtualInjector } from "react-otion/server";

const injector = VirtualInjector();
setup({ ...sharedOptions, injector });

// The resulting HTML code could be used for critical CSS extraction
renderToString(rootElement);

const styleElement = getStyleElement(injector);
setHeadComponents(styleElement);

All methods of otion/server are re-exported for convenience, as seen in the previous snippet.

Single-page applications

This package is not necessary for single page React applications, e.g. those built with Create React App.

0.6.2

4 years ago

0.6.1

4 years ago

0.5.5

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.0

4 years ago

0.3.1

4 years ago

0.2.5

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago