Pergunta de entrevista da empresa Praeclarum Tech

Can you explain the difference between state and props in React?

Resposta da entrevista

Sigiloso

27 de jun. de 2024

In React, state and props are both used to manage data, but they serve different purposes: State: State is a component's internal data storage. It is managed within the component and can be changed by the component itself. When the state changes, the component re-renders to reflect those changes. Props: Props are short for properties. They are read-only and are used to pass data from a parent component to a child component. Props help make components reusable and customizable.