But first, let me explain how I ended up finding this hook. I am spending some time, studying Refine dev source code, to learn how they have built React framework that can be used to build Enterprise applications. I will soon release this content about Refine source code on my learning platform. Because of this reason, I started with reading the Refine docs about Refine component that is core.
You see this Refine is imported from @refinedev/core. Here @refinedev/core is a package name. At this point, I searched for this package in the refine repository and found it in packages/core/package.json.
import type { LegacyRouterProvider } from "../../../contexts/router/legacy/types";import type { RouterProvider } from "../../../contexts/router/types";export const checkRouterPropMisuse = ( value: LegacyRouterProvider | RouterProvider,) => { // check if `routerProvider` prop is passed with legacy properties. // If yes, console.warn the user to use `legacyRuterProvider` prop instead. const bindings = ["go", "parse", "back", "Link"]; // check if `value` contains properties other than `bindings` const otherProps = Object.keys(value).filter( (key) => !bindings.includes(key), ); const hasOtherProps = otherProps.length > 0; if (hasOtherProps) { console.warn( `Unsupported properties are found in \`routerProvider\` prop. You provided \`${otherProps.join( ", ", )}\`. Supported properties are \`${bindings.join( ", ", )}\`. You may wanted to use \`legacyRouterProvider\` prop instead.`, ); return true; } return false;};
Hey, my name is Ramu Narasinga. I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.