async
lifecycle
browser
utilities
Create project
Run the following command to create a new TanStack Start project:
npm create @tanstack/start@latest my-app -- --tailwindEdit tsconfig.json file
Ensure your tsconfig.json includes path aliases:
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}Run the CLI
Run the useverse init command to setup your project:
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.
npx useverse@latest add useBooleanThe command above will add the useBoolean hook to your project. You can then import it like this:
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;