This tutorial uses Vite + Material UI + REST API. You can choose different options based on your preferences.
Create your project
Start by creating a new Refine project using the CLI:Select Material UI for the UI framework
Material UI offers a comprehensive set of pre-built components.
Understanding the Refine component
The heart of every Refine application is the<Refine> component. Open src/App.tsx to see the basic structure:
src/App.tsx
Create a list page
Now let’s create a page to display a list of products. Create a new filesrc/pages/products/list.tsx:
src/pages/products/list.tsx
What’s happening here?
Let’s break down the key parts:useDataGridhook - Automatically handles pagination, sorting, and filtering for Material UI’s DataGriduseManyhook - Fetches related category data for each product<List>component - Provides a pre-built wrapper with create button, breadcrumbs, and other utilities<DataGrid>component - Material UI’s data table with built-in features
Refine hooks like
useDataGrid and useMany automatically communicate with your data provider, managing loading states, error handling, and caching.Add create and edit pages
Update yourresources configuration to include create and edit routes:
src/App.tsx
- Add a “Create” button to the list page
- Add “Edit” buttons to each row in the table
- Handle navigation between pages
Run your application
Start the development server:http://localhost:5173 and you’ll see your Refine application with:
- A navigation menu automatically generated from your resources
- A product list page with sorting and pagination
- Loading states and error handling built-in
Key concepts you’ve learned
The Refine component
The
<Refine> component is the entry point that configures your application with providers and resources.Data providers
Data providers abstract away API communication, making it easy to switch between different backends.
Resources
Resources define your data entities and their routes. Refine uses this to generate navigation and route handling.
Next steps
Now that you have a basic Refine application running, you can:Add authentication
Secure your application with login and access control
Customize the UI
Style your application and override default components
Connect to your API
Replace the demo API with your own backend
Follow the tutorial
Build a full-featured CRUD application step-by-step