- What is a declarative UI structure and how does React support this idea?
- A declarative UI is built from components that are all declared before they're used. React will fail to render if all components aren't declared upfront.
- Declarative UI structures define what the UI component is instead of worrying about how it is defined. React supports this idea by allowing components to be declared using JSX syntax.
- Declarative UI structures are entirely optional in React. You can just as easily follow an imperative approach.
- How does React improve rendering performance?
- React has a virtual DOM that compares changes made to components' data in memory, avoiding the browser DOM when possible. React 16 has a new internal architecture that allows rendering to be split up into smaller chunks of work and prioritized.
- React sets up web workers so that whenever possible, work is parallelized.
- React doesn't focus on performance, instead relying on incremental browser performance improvements.
- When would you render a fragment?
- Fragments are used when you need a placeholder in your rendered content.
- Fragments are used to improve the performance of its child elements.
- Fragments are used to avoid having to render unnecessary DOM elements.