Skip to main content

Setting up the Store

We'll create a simple Todo List app, with a list of todos and a button to add a new todo.

It's the kind of code an AI agent writes with Kiss. Type along if you like, but the goal is that you can read each piece, and know why it's there.

Start by declaring App as the root React component:

main.tsx
import React from 'react'
import { createRoot } from 'react-dom/client'
import { App } from './App'

const container = document.getElementById('root');
const root = createRoot(container!);
root.render(<React.StrictMode><App/></React.StrictMode>);

We then create the Kiss store, and make it available:

App.tsx
import React from "react";
import { createStore, StoreProvider } from 'kiss-for-react';

const store = createStore<State>({
initialState: State.initialState,
});

export const App: React.FC = () => {
return (
<StoreProvider store={store}>
<AppContent />
</StoreProvider>
);
}