## 更新内容 ### 侧边栏配置修复 - 主侧边栏 (reactLearningCenter): 组件模式模块增加"高级模式"子分类 - 兼容侧边栏 (tutorialSidebar): 同步更新组件模式导航 ### 高级模式文档 (7篇) 1. **context-patterns** - Context模式深度应用 2. **hooks-patterns** - Hooks组合模式 3. **error-boundaries** - 错误边界实现 4. **children-patterns** - Children组合模式 5. **props-getters** - Props Getters模式 6. **controlled-uncontrolled** - 受控与非受控组件 7. **composition-vs-inheritance** - 组合与继承对比 ### 完整模块结构 - 基础入门:8篇 ✅ - React Hooks:7篇 ✅ - 基础Hooks:3篇 - 进阶Hooks:4篇 - 组件模式:12篇 ✅ - 基础模式:5篇 - 高级模式:7篇 (新增) - 状态管理:5篇 ✅ - 基础概念:2篇 - 中级方案:3篇 - 性能优化:3篇 ✅ ### 统计信息 - 总文档数:37篇 - 所有文档已同步到侧边栏 - 完整的学习路径已建立 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
221 lines
5.8 KiB
JavaScript
221 lines
5.8 KiB
JavaScript
// @ts-check
|
|
|
|
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
|
|
|
/**
|
|
* Creating a sidebar enables you to:
|
|
- create an ordered group of docs
|
|
- render a sidebar for each doc of that group
|
|
- provide next/previous navigation
|
|
|
|
The sidebars can be generated from the filesystem, or explicitly defined here.
|
|
|
|
Create as many sidebars as you want.
|
|
|
|
@type {import('@docusaurus/plugin-content-docs').SidebarsConfig}
|
|
*/
|
|
const sidebars = {
|
|
// Main sidebar for React Learning Center
|
|
reactLearningCenter: [
|
|
'intro',
|
|
'roadmap',
|
|
{
|
|
type: 'category',
|
|
label: '🚀 基础入门',
|
|
collapsed: false,
|
|
items: [
|
|
'foundations/what-is-react',
|
|
'foundations/jsx-syntax',
|
|
'foundations/components-props',
|
|
'foundations/state-lifecycle',
|
|
'foundations/events',
|
|
'foundations/conditional-rendering',
|
|
'foundations/lists-and-keys',
|
|
'foundations/forms',
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: '🎣 React Hooks',
|
|
collapsed: true,
|
|
items: [
|
|
{
|
|
type: 'category',
|
|
label: '基础Hooks',
|
|
collapsed: true,
|
|
items: [
|
|
'hooks/basics/useState',
|
|
'hooks/basics/useEffect',
|
|
'hooks/basics/useContext',
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: '进阶Hooks',
|
|
collapsed: true,
|
|
items: [
|
|
'hooks/advanced/useReducer',
|
|
'hooks/advanced/useCallback',
|
|
'hooks/advanced/useMemo',
|
|
'hooks/advanced/custom-hooks',
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: '🧩 组件模式',
|
|
collapsed: true,
|
|
items: [
|
|
{
|
|
type: 'category',
|
|
label: '基础模式',
|
|
collapsed: true,
|
|
items: [
|
|
'patterns/basics/functional-components',
|
|
'patterns/basics/higher-order-components',
|
|
'patterns/basics/render-props',
|
|
'patterns/basics/compound-components',
|
|
'patterns/basics/container-presentational'
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: '高级模式',
|
|
collapsed: true,
|
|
items: [
|
|
'patterns/advanced/context-patterns',
|
|
'patterns/advanced/hooks-patterns',
|
|
'patterns/advanced/error-boundaries',
|
|
'patterns/advanced/children-patterns',
|
|
'patterns/advanced/props-getters',
|
|
'patterns/advanced/controlled-uncontrolled',
|
|
'patterns/advanced/composition-vs-inheritance'
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: '🌊 状态管理',
|
|
collapsed: true,
|
|
items: [
|
|
{
|
|
type: 'category',
|
|
label: '基础概念',
|
|
collapsed: true,
|
|
items: [
|
|
'state-management/basics/local-vs-global',
|
|
'state-management/basics/context-api',
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: '中级方案',
|
|
collapsed: true,
|
|
items: [
|
|
'state-management/intermediate/redux-fundamentals',
|
|
'state-management/intermediate/zustand',
|
|
'state-management/intermediate/jotai',
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: '⚡ 性能优化',
|
|
collapsed: true,
|
|
items: [
|
|
'performance/basics/react-memo',
|
|
'performance/basics/virtualization',
|
|
'performance/basics/code-splitting',
|
|
]
|
|
}
|
|
],
|
|
|
|
// Legacy sidebar for backward compatibility
|
|
tutorialSidebar: [
|
|
'intro',
|
|
'roadmap',
|
|
{
|
|
type: 'category',
|
|
label: '基础入门',
|
|
items: [
|
|
'foundations/what-is-react',
|
|
'foundations/jsx-syntax',
|
|
'foundations/components-props',
|
|
'foundations/state-lifecycle',
|
|
'foundations/events',
|
|
'foundations/conditional-rendering',
|
|
'foundations/lists-and-keys',
|
|
'foundations/forms',
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: 'React Hooks',
|
|
items: [
|
|
'hooks/basics/useState',
|
|
'hooks/basics/useEffect',
|
|
'hooks/basics/useContext',
|
|
'hooks/advanced/useReducer',
|
|
'hooks/advanced/useCallback',
|
|
'hooks/advanced/useMemo',
|
|
'hooks/advanced/custom-hooks',
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: '组件模式',
|
|
items: [
|
|
{
|
|
type: 'category',
|
|
label: '基础模式',
|
|
items: [
|
|
'patterns/basics/functional-components',
|
|
'patterns/basics/higher-order-components',
|
|
'patterns/basics/render-props',
|
|
'patterns/basics/compound-components',
|
|
'patterns/basics/container-presentational'
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: '高级模式',
|
|
items: [
|
|
'patterns/advanced/context-patterns',
|
|
'patterns/advanced/hooks-patterns',
|
|
'patterns/advanced/error-boundaries',
|
|
'patterns/advanced/children-patterns',
|
|
'patterns/advanced/props-getters',
|
|
'patterns/advanced/controlled-uncontrolled',
|
|
'patterns/advanced/composition-vs-inheritance'
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: '状态管理',
|
|
items: [
|
|
'state-management/basics/local-vs-global',
|
|
'state-management/basics/context-api',
|
|
'state-management/intermediate/redux-fundamentals',
|
|
'state-management/intermediate/zustand',
|
|
'state-management/intermediate/jotai',
|
|
]
|
|
},
|
|
{
|
|
type: 'category',
|
|
label: '性能优化',
|
|
items: [
|
|
'performance/basics/react-memo',
|
|
'performance/basics/virtualization',
|
|
'performance/basics/code-splitting',
|
|
]
|
|
}
|
|
]
|
|
};
|
|
|
|
export default sidebars;
|