Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ One-way data flow can lead to better performance because it reduces the complexi

## Further reading

- [React documentation on components and props](https://reactjs.org/docs/components-and-props.html)
- [React documentation on state and lifecycle](https://reactjs.org/docs/state-and-lifecycle.html)
- [React documentation on lifting state up](https://reactjs.org/docs/lifting-state-up.html)
- [React documentation on components and props](https://react.dev/learn/passing-props-to-a-component)
- [React documentation on state](https://react.dev/learn/state-a-components-memory)
- [React documentation on lifting state up](https://react.dev/learn/sharing-state-between-components)
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ export default ChildComponent;

## 延伸阅读

* [React 组件和 props 文档](https://reactjs.org/docs/components-and-props.html)
* [React 状态和生命周期文档](https://reactjs.org/docs/state-and-lifecycle.html)
* [React 提升状态文档](https://reactjs.org/docs/lifting-state-up.html)
* [React 组件和 props 文档](https://react.dev/learn/passing-props-to-a-component)
* [React 状态文档](https://react.dev/learn/state-a-components-memory)
* [React 提升状态文档](https://react.dev/learn/sharing-state-between-components)
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ export default Home;
## Further reading

- [Next.js Documentation](https://nextjs.org/docs)
- [React Server Components](https://reactjs.org/docs/react-server.html)
- [Server-side rendering in React](https://reactjs.org/docs/react-dom-server.html)
- [React Server Components](https://react.dev/reference/rsc/server-components)
- [Server-side rendering in React](https://react.dev/reference/react-dom/server)
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ export default Home;

## 延伸阅读

* [React 中的服务器端渲染](https://reactjs.org/docs/react-dom-server.html)
* [React 中的服务器端渲染](https://react.dev/reference/react-dom/server)
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ In this example, the `getStaticProps` function fetches data at build time, and t
## Further reading

- [Next.js documentation on static generation](https://nextjs.org/docs/basic-features/pages#static-generation-recommended)
- [React official documentation](https://reactjs.org/docs/getting-started.html)
- [React official documentation](https://react.dev/learn)
- [Static site generators comparison](https://www.staticgen.com/)
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ export default HomePage;
## 延伸阅读

* [Next.js 关于静态生成的文档](https://nextjs.org/docs/basic-features/pages#static-generation-recommended)
* [React 官方文档](https://reactjs.org/docs/getting-started.html)
* [React 官方文档](https://react.dev/learn)
* [静态网站生成器比较](https://www.staticgen.com/)
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,4 @@ function App() {
## Further reading

- [Composition in React](https://krasimir.gitbooks.io/react-in-patterns/content/chapter-04/)
- [React patterns: Composition](https://reactpatterns.com/#composition)
- [Medium article on React composition](https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0)
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,5 @@ function App() {

## 延伸阅读

* [React 关于组合而非继承的文档](https://reactjs.org/docs/composition-vs-inheritance.html)
* [React 模式:组合](https://reactpatterns.com/#composition)
* [关于 React 组合的 Medium 文章](https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0)
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ export default connect(null, mapDispatchToProps)(ButtonContainer);

## Further reading

- [React documentation on components and props](https://reactjs.org/docs/components-and-props.html)
- [React documentation on components and props](https://react.dev/learn/passing-props-to-a-component)
- [Dan Abramov's article on presentational and container components](https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0)
- [Redux documentation on presentational and container components](https://redux.js.org/basics/usage-with-react#presentational-and-container-components)
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ export default connect(null, mapDispatchToProps)(ButtonContainer);

## 延伸阅读

* [React 组件和 props 文档](https://reactjs.org/docs/components-and-props.html)
* [React 组件和 props 文档](https://react.dev/learn/passing-props-to-a-component)
* [Dan Abramov 关于展示组件和容器组件的文章](https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0)
* [Redux 关于展示组件和容器组件的文档](https://redux.js.org/basics/usage-with-react#presentational-and-container-components)
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ this.setState({ count: this.state.count + 1 }, () => {

## Further reading

- [React documentation on setState](https://reactjs.org/docs/react-component.html#setstate)
- [React documentation on setState](https://react.dev/reference/react/useState#setstate)
- [Understanding setState in React](https://medium.com/@baphemot/understanding-react-setstate-a4640451865b)
- [React's setState explained](https://daveceddia.com/where-fetch-data-componentwillmount-vs-componentdidmount/)
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ this.setState({ count: this.state.count + 1 }, () => {

## 延伸阅读

* [React setState 文档](https://reactjs.org/docs/react-component.html#setstate)
* [React setState 文档](https://react.dev/reference/react/useState#setstate)
* [理解 React 中的 setState](https://medium.com/@baphemot/understanding-react-setstate-a4640451865b)
* [React 的 setState 解释](https://daveceddia.com/where-fetch-data-componentwillmount-vs-componentdidmount/)
4 changes: 2 additions & 2 deletions questions/explain-what-react-hydration-is/en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ In this example, the server sends the static HTML with a button to the client. R

## Further reading

- [React documentation on hydration](https://reactjs.org/docs/react-dom.html#hydrate)
- [Server-side rendering in React](https://reactjs.org/docs/react-dom-server.html)
- [React documentation on hydration](https://react.dev/reference/react-dom/client/hydrateRoot)
- [Server-side rendering in React](https://react.dev/reference/react-dom/server)
- [Next.js documentation on hydration](https://nextjs.org/docs/basic-features/pages#hydration)
4 changes: 2 additions & 2 deletions questions/explain-what-react-hydration-is/zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ React 水合是在客户端附加事件监听器并使服务器渲染的 HTML

## 延伸阅读

* [React 水合文档](https://reactjs.org/docs/react-dom.html#hydrate)
* [React 中的服务器端渲染](https://reactjs.org/docs/react-dom-server.html)
* [React 水合文档](https://react.dev/reference/react-dom/client/hydrateRoot)
* [React 中的服务器端渲染](https://react.dev/reference/react-dom/server)
* [Next.js 水合文档](https://nextjs.org/docs/basic-features/pages#hydration)
4 changes: 2 additions & 2 deletions questions/how-do-you-debug-react-applications/en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function MyComponent() {

## Further reading

- [React Developer Tools](https://reactjs.org/blog/2015/09/02/new-react-developer-tools.html)
- [Error boundaries in React](https://reactjs.org/docs/error-boundaries.html)
- [React Developer Tools](https://react.dev/learn/react-developer-tools)
- [Error boundaries in React](https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary)
- [Using the Chrome DevTools](https://developers.google.com/web/tools/chrome-devtools)
- [Debugging JavaScript](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Debugging)
4 changes: 2 additions & 2 deletions questions/how-do-you-debug-react-applications/zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function MyComponent() {

## 延伸阅读

* [React 开发者工具](https://reactjs.org/blog/2015/09/02/new-react-developer-tools.html)
* [React 中的错误边界](https://reactjs.org/docs/error-boundaries.html)
* [React 开发者工具](https://react.dev/learn/react-developer-tools)
* [React 中的错误边界](https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary)
* [使用 Chrome DevTools](https://developers.google.com/web/tools/chrome-devtools)
* [调试 JavaScript](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Debugging)
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function App() {

## Further reading

- [React documentation on state](https://reactjs.org/docs/state-and-lifecycle.html)
- [React documentation on context](https://reactjs.org/docs/context.html)
- [React documentation on state](https://react.dev/learn/state-a-components-memory)
- [React documentation on context](https://react.dev/learn/passing-data-deeply-with-context)
- [Redux documentation](https://redux.js.org/)
- [MobX documentation](https://mobx.js.org/README.html)
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function App() {

## 延伸阅读

* [React 状态文档](https://reactjs.org/docs/state-and-lifecycle.html)
* [React 上下文文档](https://reactjs.org/docs/context.html)
* [React 状态文档](https://react.dev/learn/state-a-components-memory)
* [React 上下文文档](https://react.dev/learn/passing-data-deeply-with-context)
* [Redux 文档](https://redux.js.org/)
* [MobX 文档](https://mobx.js.org/README.html)
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function DataFetchingComponent() {

## Further reading

- [React documentation on hooks](https://reactjs.org/docs/hooks-intro.html)
- [Using the Effect Hook](https://reactjs.org/docs/hooks-effect.html)
- [React documentation on hooks](https://react.dev/reference/react/hooks)
- [React useEffect Hook](https://react.dev/reference/react/useEffect)
- [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
- [Handling errors in async functions](https://javascript.info/async-await#error-handling)
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function DataFetchingComponent() {

## 延伸阅读

* [React 钩子文档](https://reactjs.org/docs/hooks-intro.html)
* [使用 Effect 钩子](https://reactjs.org/docs/hooks-effect.html)
* [React 钩子文档](https://react.dev/reference/react/hooks)
* [React useEffect Hook 文档](https://react.dev/reference/react/useEffect)
* [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
* [处理异步函数中的错误](https://javascript.info/async-await#error-handling)
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ export default MyComponent;

## Further reading

- [React useState Hook](https://reactjs.org/docs/hooks-state.html)
- [React Component State](https://reactjs.org/docs/state-and-lifecycle.html)
- [React Functional Components](https://reactjs.org/docs/components-and-props.html#function-and-class-components)
- [React useState Hook](https://react.dev/reference/react/useState)
- [React Component State](https://react.dev/learn/state-a-components-memory)
- [React Functional Components](https://react.dev/reference/react/Component)
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ export default MyComponent;

## 延伸阅读

* [React useState Hook](https://reactjs.org/docs/hooks-state.html)
* [React Component State](https://reactjs.org/docs/state-and-lifecycle.html)
* [React Functional Components](https://reactjs.org/docs/components-and-props.html#function-and-class-components)
* [React useState Hook](https://react.dev/reference/react/useState)
* [React Component State](https://react.dev/learn/state-a-components-memory)
* [React Functional Components](https://react.dev/reference/react/Component)
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ class MyComponent extends React.Component {

## 延伸阅读

* [React 关于协调的文档](https://reactjs.org/docs/reconciliation.html)
* [React 关于协调的文档](https://react.dev/learn/preserving-and-resetting-state)
* [理解虚拟 DOM](https://medium.com/@deathmood/how-to-write-your-own-virtual-dom-ee74acc13060)
* [React 性能优化](https://reactjs.org/docs/optimizing-performance.html)
* [React memo 性能优化](https://react.dev/reference/react/memo#skipping-re-rendering-when-props-are-unchanged)
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ const MyComponent = () => {

## Further reading

- [React Context API documentation](https://reactjs.org/docs/context.html)
- [useMemo Hook documentation](https://reactjs.org/docs/hooks-reference.html#usememo)
- [React documentation on context](https://react.dev/learn/passing-data-deeply-with-context)
- [useMemo Hook documentation](https://react.dev/reference/react/useMemo)
- [use-context-selector library](https://github.com/dai-shi/use-context-selector)
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ const MyComponent = () => {

## 延伸阅读

* [React Context API 文档](https://reactjs.org/docs/context.html)
* [useMemo Hook 文档](https://reactjs.org/docs/hooks-reference.html#usememo)
* [React 上下文文档](https://react.dev/learn/passing-data-deeply-with-context)
* [useMemo Hook 文档](https://react.dev/reference/react/useMemo)
* [use-context-selector 库](https://github.com/dai-shi/use-context-selector)
4 changes: 1 addition & 3 deletions questions/what-are-error-boundaries-in-react-for/en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,4 @@ Error boundaries have some limitations:

## Further reading

- [React documentation on error boundaries](https://reactjs.org/docs/error-boundaries.html)
- [Handling errors in React](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html)
- [Error boundaries in React 16](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html)
- [React documentation on error boundaries](https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary)
4 changes: 1 addition & 3 deletions questions/what-are-error-boundaries-in-react-for/zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,4 @@ export default ErrorBoundary;

## 延伸阅读

* [React 错误边界文档](https://reactjs.org/docs/error-boundaries.html)
* [在 React 中处理错误](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html)
* [React 16 中的错误边界](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html)
* [React 错误边界文档](https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary)
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,5 @@ In this example, `withExtraProps` is an HOC that adds an `extraProp` to `MyCompo

## Further reading

- [React documentation on higher order components](https://reactjs.org/docs/higher-order-components.html)
- [Understanding higher order components in React](https://medium.com/@franleplant/react-higher-order-components-in-depth-cf9032ee6c3e)
- [HOCs vs Render Props vs Hooks](https://blog.logrocket.com/hooks-vs-render-props-vs-hocs/)
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,5 @@ export default App;

## 延伸阅读

* [React 关于高阶组件的文档](https://reactjs.org/docs/higher-order-components.html)
* [理解 React 中的高阶组件](https://medium.com/@franleplant/react-higher-order-components-in-depth-cf9032ee6c3e)
* [HOCs vs Render Props vs Hooks](https://blog.logrocket.com/hooks-vs-render-props-vs-hocs/)
2 changes: 1 addition & 1 deletion questions/what-are-react-fragments-used-for/en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ return (

## Further reading

- [React Fragments - Official Documentation](https://reactjs.org/docs/fragments.html)
- [React Fragments - Official Documentation](https://react.dev/reference/react/Fragment)
- [React Fragments - A Complete Guide](https://www.freecodecamp.org/news/react-fragments-complete-guide/)
- [When to use React Fragments](https://blog.logrocket.com/when-to-use-react-fragments/)
2 changes: 1 addition & 1 deletion questions/what-are-react-fragments-used-for/zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ return (

## 延伸阅读

* [React Fragments - 官方文档](https://reactjs.org/docs/fragments.html)
* [React Fragments - 官方文档](https://react.dev/reference/react/Fragment)
* [React Fragments - 完整指南](https://www.freecodecamp.org/news/react-fragments-complete-guide/)
* [何时使用 React Fragments](https://blog.logrocket.com/when-to-use-react-fragments/)
2 changes: 1 addition & 1 deletion questions/what-are-react-portals-used-for/en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ ReactDOM.createPortal(child, container);

## Further reading

- [React Portals documentation](https://reactjs.org/docs/portals.html)
- [React createPortal documentation](https://react.dev/reference/react-dom/createPortal)
- [Building a modal with React Portals](https://blog.logrocket.com/building-a-modal-with-react-portals/)
- [Using React Portals for better accessibility](https://www.smashingmagazine.com/2020/03/react-portals-accessibility/)
2 changes: 1 addition & 1 deletion questions/what-are-react-portals-used-for/zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ ReactDOM.createPortal(child, container);

## 延伸阅读

* [React Portals 文档](https://reactjs.org/docs/portals.html)
* [React createPortal 文档](https://react.dev/reference/react-dom/createPortal)
* [使用 React Portals 构建模态框](https://blog.logrocket.com/building-a-modal-with-react-portals/)
* [使用 React Portals 提高可访问性](https://www.smashingmagazine.com/2020/03/react-portals-accessibility/)
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,4 @@ In this example, `MouseTracker` is a component that tracks the mouse position an

## Further reading

- [React documentation on render props](https://reactjs.org/docs/render-props.html)
- [Render props vs. higher-order components](https://reactjs.org/docs/higher-order-components.html#convention-wrap-the-display-name-for-easy-debugging)
- [Advanced React patterns](https://kentcdodds.com/blog/compound-components-with-react-hooks)
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,4 @@ class MouseTracker extends React.Component {

## 延伸阅读

* [React render props 文档](https://reactjs.org/docs/render-props.html)
* [Render props vs. 高阶组件](https://reactjs.org/docs/higher-order-components.html#convention-wrap-the-display-name-for-easy-debugging)
* [高级 React 模式](https://kentcdodds.com/blog/compound-components-with-react-hooks)
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@ const MyComponent = () => {

## Further reading

- [React documentation on hooks](https://reactjs.org/docs/hooks-intro.html)
- [React documentation on `useEffect`](https://reactjs.org/docs/hooks-effect.html)
- [React documentation on hooks](https://react.dev/reference/react/hooks)
- [React documentation on `useEffect`](https://react.dev/reference/react/useEffect)
- [Handling async requests in React](https://www.robinwieruch.de/react-hooks-fetch-data)
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@ const MyComponent = () => {

## 延伸阅读

* [React hooks 文档](https://reactjs.org/docs/hooks-intro.html)
* [React `useEffect` 文档](https://reactjs.org/docs/hooks-effect.html)
* [React hooks 文档](https://react.dev/reference/react/hooks)
* [React `useEffect` 文档](https://react.dev/reference/react/useEffect)
* [在 React 中处理异步请求](https://www.robinwieruch.de/react-hooks-fetch-data)
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ For more complex state management needs, consider using other state management s

## Further reading

- [React Context API](https://reactjs.org/docs/context.html)
- [React Performance Optimization](https://reactjs.org/docs/optimizing-performance.html)
- [React Context](https://react.dev/learn/passing-data-deeply-with-context)
- [React memo Performance Optimization](https://react.dev/reference/react/memo#skipping-re-rendering-when-props-are-unchanged)
- [Redux](https://redux.js.org/)
- [Zustand](https://github.com/pmndrs/zustand)
- [Recoil](https://recoiljs.org/)
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Context 提供了一种在组件树中传递数据的方法,而无需在每个

## 延伸阅读

* [React Context API](https://reactjs.org/docs/context.html)
* [React 性能优化](https://reactjs.org/docs/optimizing-performance.html)
* [React Context](https://react.dev/learn/passing-data-deeply-with-context)
* [React memo 性能优化](https://react.dev/reference/react/memo#skipping-re-rendering-when-props-are-unchanged)
* [Redux](https://redux.js.org/)
* [Zustand](https://github.com/pmndrs/zustand)
* [Recoil](https://recoiljs.org/)
8 changes: 4 additions & 4 deletions questions/what-are-some-react-anti-patterns/en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ this.state = {

## Further reading

- [React documentation on state and lifecycle](https://reactjs.org/docs/state-and-lifecycle.html)
- [React documentation on lists and keys](https://reactjs.org/docs/lists-and-keys.html)
- [React documentation on hooks](https://reactjs.org/docs/hooks-intro.html)
- [React documentation on optimizing performance](https://reactjs.org/docs/optimizing-performance.html)
- [React documentation on state](https://react.dev/learn/state-a-components-memory)
- [React documentation on lists and keys](https://react.dev/learn/rendering-lists#why-does-react-need-keys)
- [React documentation on hooks](https://react.dev/reference/react/hooks)
- [React documentation on memo optimizing performance](https://react.dev/reference/react/memo)
Loading