Getting started
Installation
Core library
- npm
- yarn
- pnpm
npm install signia
yarn add signia
pnpm add signia
React bindings
signia
has no dependencies, and is useful outside of react applications.
However if you wish to use it in a react app, we have officially-supported bindings available.
These bindings do not currently work with legacy class components. We may be willing to add and maintain legacy support if there is sufficient demand. Let us know!
- npm
- yarn
- pnpm
npm install signia-react
yarn add signia-react
pnpm add signia-react
Automatic component tracking
If you wish to enable tracking on all functional components automatically, run:
- npm
- yarn
- pnpm
npm install signia-react-jsx
yarn add signia-react-jsx
pnpm add signia-react-jsx
And then make your tsconfig.json
include these properties:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "signia-react-jsx"
}
}
If you are using Vite, you will need to add jsxImportSource
to your vite.config.ts
:
import react from '@vitejs/plugin-react-swc'
import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react({ jsxImportSource: 'signia-react-jsx' })],
})
Using the Remix Web framework? This package may need a little extra TLC.
Please see "Writing reactive components" for more.
Next: Read the tutorial
The Using Signals Tutorial will walk you through the basics of using signia
in an application.