React-Router v6 源码解析

  • Post author:
  • Post category:其他


1

Route组件

/**
 * Declares an element that should be rendered at a certain URL path.
 *
 * @see https://reactrouter.com/components/route
 */
export function Route(_props: RouteProps): React.ReactElement | null {
  invariant(
    false,
    `A <Route> is only ever to be used as the child of <Routes> element, ` +
      `never rendered directly. Please wrap your <Route> in a <Routes>.`
  );
}


Route组件在v6中返回就是一个undefined。



版权声明:本文为qq_33715850原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。