Notice: file_put_contents(): Write of 16696 bytes failed with errno=28 No space left on device in /var/www/tgoop/post.php on line 50
Frontender Libs - обзор библиотек JS / CSS@sWebDev P.3028
SWEBDEV Telegram 3028
Ленивое обнаружение роутов в React

Метод unstable_patchRoutesOnMiss в React Router позволяет загружать дополнительные роуты динамически, реализуя разделение кода.

Пример использования:
import { createBrowserRouter } from 'react-router-dom';

const router = createBrowserRouter(
[
{
id: "root",
path: "/",
Component: RootComponent,
},
],
{
async unstable_patchRoutesOnMiss({ path, patch }) {
if (path === "/a") {
let route = await getARoute();
patch("root", [route]);
}
},
}
);

async function getARoute() {
return { path: 'a', Component: A };
}

В этом примере, если пользователь переходит по пути /a, метод unstable_patchRoutesOnMiss загружает роут динамически и добавляет его к роуту root.

👉 @sWebDev
👍31



tgoop.com/sWebDev/3028
Create:
Last Update:

Ленивое обнаружение роутов в React

Метод unstable_patchRoutesOnMiss в React Router позволяет загружать дополнительные роуты динамически, реализуя разделение кода.

Пример использования:

import { createBrowserRouter } from 'react-router-dom';

const router = createBrowserRouter(
[
{
id: "root",
path: "/",
Component: RootComponent,
},
],
{
async unstable_patchRoutesOnMiss({ path, patch }) {
if (path === "/a") {
let route = await getARoute();
patch("root", [route]);
}
},
}
);

async function getARoute() {
return { path: 'a', Component: A };
}

В этом примере, если пользователь переходит по пути /a, метод unstable_patchRoutesOnMiss загружает роут динамически и добавляет его к роуту root.

👉 @sWebDev

BY Frontender Libs - обзор библиотек JS / CSS




Share with your friend now:
tgoop.com/sWebDev/3028

View MORE
Open in Telegram


Telegram News

Date: |

Telegram Android app: Open the chats list, click the menu icon and select “New Channel.” You can invite up to 200 people from your contacts to join your channel as the next step. Select the users you want to add and click “Invite.” You can skip this step altogether. The group also hosted discussions on committing arson, Judge Hui said, including setting roadblocks on fire, hurling petrol bombs at police stations and teaching people to make such weapons. The conversation linked to arson went on for two to three months, Hui said. Telegram users themselves will be able to flag and report potentially false content. To view your bio, click the Menu icon and select “View channel info.”
from us


Telegram Frontender Libs - обзор библиотек JS / CSS
FROM American