The translation was generated automatically and may contain mistakes
Module: 4. Development
Lesson 3. Routing
The main thing in the lesson
- •
For navigation in VKUI applications, we recommend using the library vk-mini-apps-router . It takes into account all the features of VKUI. In addition, it can work in applications that run on the platform VK Mini Apps, and in independent applications.
- •
After connecting the Library выберите type of router used . It depends on the route format in the URL.
- •
The route determines which screen should be displayed based on the URL PASSED. You create an array of routes in the application code and pass it to the router creation function. The route may contain parameters .
- •
The code that demonstrates the router connection can be viewed in the repository, which contains the source code of the lesson. Detailed description in vk-mini-apps-router library documentation .
- •
To navigate between application screens, call a hook
useRouteNavigatorIn order to obtain an objectRouteNavigatorand use the methods of this object:push(...),replace(...),back(),backToFirst(). - •
To get the parameters specified in the path, use hooks
useParams()?1?useSearchParams().
Useful links
- •Client part (source code) ,
Look at the code fragments by #M4L3> - •
- •
- •
- •
:::