Use colon and comma invite + react in createBrowserRouter
P粉165522886
P粉165522886 2023-09-06 23:36:47
0
1
494

Hi, I've been searching but couldn't find any similar question. The server I'm using is running, but it's not working as expected from the tutorial I'm following.

I'm using the latest versions of vs code, xampp, composer, Laravel, nodejs and npm, so here's the code:

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

//指定路由
const router = createBrowserRouter(routes: [])
export default router;

The colon before routes (routes:) has an underline in red and displays "expected ','". I'm following this video https://youtu.be/qJq9ZMB2Was, at about 23:02.

Thank you very much for your help, I am still learning and am a beginner in this field.

should not be underlined in red.

P粉165522886
P粉165522886

reply all(1)
P粉005105443

The routes: you see in the video is not actually part of the code; it comes from an IDE extension that displays the developer's function parameter names. So just change it to:

const router = createBrowserRouter([])
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template