๐ Zero boilerplate
Automates actions, reducers, and selectors so you can focus on what matters.
Install with npm or yarn:
npm install scaluxor use the official template :
npx degit scalux/scalux-vite-template my-app
cd my-app
npm install # or pnpm / yarn
npm run devThis template provides a ready-to-use Vite + React + Scalux setup with TypeScript, ESLint and Prettier.
The official template with the sample app
Create a fully functional counter application in just a few lines:
// src/app.tsx
import { State } from "scalux";
const { Component, register } = State({ count: 0 });
const CounterComponent = Component({
domain: "Counter",
render: ({ value, increment, decrement }) => (
<div>
<button onClick={increment}>+</button>
<span>{value}</span>
<button onClick={decrement}>-</button>
</div>
),
data: (state) => ({ value: state.count }),
handlers: {
increment: (state) => ({ count: state.count + 1 }),
decrement: (state) => ({ count: state.count - 1 }),
},
});
const { reducer } = register();
export { CounterComponent, reducer };// src/store.ts
import { configureStore } from "scalux";
import { reducer } from "./app";
export const store = configureStore({ reducer });// src/main.tsx
import ReactDOM from "react-dom/client";
import { Provider } from "scalux";
import { CounterComponent } from "./app";
import { store } from "./store";
ReactDOM.createRoot(document.getElementById("root")!).render(
<Provider store={store}>
<CounterComponent />
</Provider>
);Undoable.