Introduction

CSS-in-JS lib that helps to define CSS for the React components on the client & server, without any additional configuration from either side.

Advantages

Getting started

You should not need any additional configuration, just make sure your app uses React 18.

1. Install the module

npm i @ssr-tools/css

2. Wrap your entry point component with <StyleCacheProvider>

Usually, it would be App.tsx:

// App.tsx

export const App = () => {
  return (
    <StyleCacheProvider>
      <Router />
      {/* ...other providers, etc... */}
    </StyleCacheProvider>
  )
};

3. Add some css

Now you can add the css using components from @ssr-tools/css/stylables/* or @ssr-tools/css/components/StyleBuilder. See Api section below.