Skip to main content

Initialize project

In this part you'll learn how to create new app with stocked

Create React App

Let's create a new project using create-react-app utility. Run this command in your terminal

npx create-react-app my-app
Pro tip!

If you want to use typescript in your project, specify one more flag to the create-react-app: --template typescript.

Install dependencies

To install latest stocked stable version, run this command:

npm install stocked

Create app state

Delete everything from your ./src/App.jsx and wrap your app content with StockRoot component:

./src/App.jsx
import { StockRoot } from 'stocked';

function App() {
return (
<StockRoot initialValues={{}}>
<h1>Todo list!</h1>
</StockRoot>
);
}

export default App;

And that's it! You've initialized your first app with stocked! Continue to the next section to complete this tutorial!