diff --git a/beta/src/components/MDX/MDXComponents.tsx b/beta/src/components/MDX/MDXComponents.tsx index 8269e47e0..3b1fd820d 100644 --- a/beta/src/components/MDX/MDXComponents.tsx +++ b/beta/src/components/MDX/MDXComponents.tsx @@ -325,6 +325,9 @@ function calculateNestedToc(toc: Toc): NestedTocRoot { function InlineToc() { const toc = useContext(TocContext); const root = useMemo(() => calculateNestedToc(toc), [toc]); + if (root.children.length < 2) { + return null; + } return ; } diff --git a/beta/src/content/apis/react/other.md b/beta/src/content/apis/react/apis.md similarity index 51% rename from beta/src/content/apis/react/other.md rename to beta/src/content/apis/react/apis.md index 38bb1ff98..84fdd2228 100644 --- a/beta/src/content/apis/react/other.md +++ b/beta/src/content/apis/react/apis.md @@ -1,10 +1,10 @@ --- -title: "react: Other APIs" +title: "react: APIs" --- -In addition to [Hooks,](/apis/react) the `react` package exports a few components and other APIs that are useful for defining components. This page lists all the modern React APIs that are not Hooks. +In addition to [Hooks](/apis/react) and [Components](/apis/react/components), the `react` package exports a few other APIs that are useful for defining components. This page lists all the remaining modern React APIs. @@ -12,17 +12,7 @@ In addition to [Hooks,](/apis/react) the `react` package exports a few component --- -## Built-in React components {/*built-in-react-components*/} - -React exposes a few built-in components that you can use in your JSX. - -* [``](/apis/react/Fragment), alternatively written as `<>...`, lets you group multiple JSX nodes together. -* [``](/apis/react/Suspense) lets you display a fallback while the child components are loading. -* [``](/apis/react/StrictMode) enables extra development-only checks that help you find bugs early. - ---- - -## Other React APIs {/*other-react-apis*/} +## React APIs {/*react-apis*/} * [`createContext`](/apis/react/createContext) lets you define and provide context to the child components. Used with [`useContext`.](/apis/react/useContext) * [`forwardRef`](/apis/react/forwardRef) lets your component expose a DOM node as a ref to the parent. Used with [`useRef`.](/apis/react/useRef) diff --git a/beta/src/content/apis/react/components.md b/beta/src/content/apis/react/components.md new file mode 100644 index 000000000..e70c53157 --- /dev/null +++ b/beta/src/content/apis/react/components.md @@ -0,0 +1,20 @@ +--- +title: "react: Components" +--- + + + +React exposes a few built-in components that you can use in your JSX. + + + + + +--- + +## Built-in React components {/*built-in-react-components*/} + +* [``](/apis/react/Fragment), alternatively written as `<>...`, lets you group multiple JSX nodes together. +* [``](/apis/react/Profiler) lets you measure rendering performance of a React tree programmatically. +* [``](/apis/react/Suspense) lets you display a fallback while the child components are loading. +* [``](/apis/react/StrictMode) enables extra development-only checks that help you find bugs early. diff --git a/beta/src/sidebarAPIs.json b/beta/src/sidebarAPIs.json index e9f2bfe59..90e3d1e15 100644 --- a/beta/src/sidebarAPIs.json +++ b/beta/src/sidebarAPIs.json @@ -76,8 +76,8 @@ ] }, { - "title": "react: Other APIs", - "path": "/apis/react/other", + "title": "react: Components", + "path": "/apis/react/components", "routes": [ { "title": " (<>)", @@ -94,7 +94,13 @@ { "title": "", "path": "/apis/react/Suspense" - }, + } + ] + }, + { + "title": "react: APIs", + "path": "/apis/react/apis", + "routes": [ { "title": "createContext", "path": "/apis/react/createContext"