Câu hỏi phỏng vấn Reactjs
Câu hỏi

What's a Pure Function...

Câu trả lời

A Pure Functional Component in React refers to a functional component that behaves like a pure function in the context of React's rendering behavior. In functional programming, a pure function is one that always returns the same output given the same input and does not produce side effects. Similarly, in React, a Pure Functional Component is one that renders the same output given the same props and state, and does not produce side effects during the rendering process.

React provides a mechanism to optimize functional components through React.memo(). This higher-order component wraps a functional component and memoizes its output, preventing unnecessary re-renders when the component's props have not changed. This is analogous to the React.PureComponent class for class components, which implements a shallow comparison in the shouldComponentUpdate lifecycle method to determine if re-r...

senior

senior

Gợi ý câu hỏi phỏng vấn

middle

What's wrong with using Context in React?

senior

What's the difference between useCallback and useMemo in practice?

senior

Why would you need to bind event handlers to this ?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào