TanStack Start
Install and configure reactuse for TanStack Start.
Create project
Run the following command to create a new TanStack Start project:
bash
npm create @tanstack/start@latest my-app -- --tailwindEdit tsconfig.json file
Ensure your tsconfig.json includes path aliases:
json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}Run the CLI
Run the useverse init command to setup your project:
bash
npx useverse@latest initThis will create a configuration file reactuse.json in your project.
Add hooks
You can now start adding hooks to your project.
bash
npx useverse@latest add useBooleanThe command above will add the useBoolean hook to your project. You can then import it like this:
tsx
import { useBoolean } from '@/shared/hooks';
const Home = () => {
const [on, toggle] = useBoolean();
return (
<div>
<button type='button' onClick={() => toggle()}>
Click me
</button>
<p>{on.toString()}</p>
</div>
);
};
export default Home;