🌍 ReactJS · subject
ReactJS Advanced Concepts Syllabus
Every chapter and topic of Advanced Concepts examined in ReactJS — 3 chapters, 9 topics, plus 50 flashcards written against it.
Advanced Concepts syllabus — full chapter and topic list
Expand any chapter to see its topics and sub-topics. This is the whole examinable outline for Advanced Concepts in ReactJS, not a summary of it.
-
Higher-Order Components
3 topics- What are Higher-Order Components?
- Creating Higher-Order Components
- Using Higher-Order Components
-
Render Props
3 topics- What are Render Props?
- Implementing Render Props
- Examples of Render Props
-
Portals
3 topics- What are Portals?
- Creating Portals
- Use Cases for Portals
Advanced Concepts flashcards for ReactJS
21 of 50 cards from the Advanced Concepts deck — real questions with worked answers.
What is a Higher-Order Component (HOC) in React?
A Higher-Order Component is a function that takes a component and returns a new component, adding extra behavior or props. It is a pattern for reusing component logic, not part of the React API itself.
What is the general function signature of a Higher-Order Component?
const EnhancedComponent = higherOrderComponent(WrappedComponent). The HOC receives a component as an argument and returns a new (enhanced) component.
On which JavaScript concept are HOCs based, and what is the analogy to functions?
HOCs are based on composition. They are analogous to higher-order functions: just as a higher-order function takes/returns a function, an HOC takes a component and returns a component.
Do HOCs modify the input component or use inheritance?
No. A proper HOC does not modify or mutate the input component and does not use inheritance. It composes the original component by wrapping it in a container component.
What are the two main categories of HOC implementation techniques?
1) Props Proxy (the HOC manipulates the props passed to the wrapped component), and 2) Inheritance Inversion (the HOC extends the wrapped component).
In a Props Proxy HOC, what can the HOC do?
It can manipulate props (add/edit/remove), abstract and manage state, wrap the component in other elements, and access the wrapped component's instance via refs.
What is a minimal Props Proxy HOC that injects an extra prop?
function withExtra(Wrapped) { return function(props) { return <Wrapped {...props} extra="value" />; }; } The spread {...props} passes through original props.
Why must you always spread the original props ({...props}) inside an HOC?
So the enhanced component remains transparent: it forwards all props it doesn't care about to the wrapped component, preserving the original component's interface.
What is a common HOC use case in real-world libraries?
Cross-cutting concerns such as connecting to a store (Redux's connect), adding routing props (withRouter), theming, subscribing to data sources, and injecting shared logic.
What is the naming convention for HOCs and why does it matter?
Prefix with 'with', e.g. withSubscription, withRouter, withAuth. It signals the value is an HOC and improves readability of the composed component tree.
How should you set the displayName of an HOC-produced component for debugging?
Set Enhanced.displayName = `WithSubscription(${getDisplayName(Wrapped)})`, where getDisplayName returns Wrapped.displayName || Wrapped.name || 'Component'. This makes HOCs clear in React DevTools.
What React feature must HOCs handle explicitly because it is not a prop?
Refs. Refs are not passed through automatically. Use React.forwardRef inside the HOC to forward the ref to the wrapped component.
What static-method problem occurs with HOCs, and how is it solved?
Static methods of the wrapped component are lost on the enhanced component. Solution: copy them over manually or use the hoist-non-react-statics library to hoist all non-React statics.
Where must HOCs NOT be applied, and why?
Not inside a component's render method. Applying an HOC in render creates a brand-new component type each render, forcing a full remount and losing state. Apply HOCs at module/definition level.
How do you compose multiple HOCs cleanly?
Use function composition, e.g. compose(withRouter, connect(mapState))(Component), which is equivalent to withRouter(connect(mapState)(Component)).
What is a Render Prop in React?
A render prop is a technique for sharing code between components using a prop whose value is a function that returns a React element, letting the component call it to render dynamic content.
What problem do render props solve, similar to HOCs?
They enable sharing/reuse of cross-cutting stateful logic between components without inheritance, giving the consumer control over what is rendered.
Give the canonical shape of a component using a render prop.
<DataProvider render={data => <h1>{data.value}</h1>} />. The DataProvider computes data and calls props.render(data) internally to produce the output.
Does the prop that supplies the render function have to be named 'render'?
No. Any prop whose value is a function returning an element is a render prop. It can be named anything; 'render' and 'children' are just common choices.
What is the children-as-a-function pattern in the context of render props?
Passing the function as the children prop: <Mouse>{mouse => <Cat pos={mouse} />}</Mouse>. Internally the component calls this.props.children(state).
Inside a render-prop component, how does it invoke the render prop?
In its render method it calls the function prop with its internal state, e.g. return this.props.render(this.state); (or this.props.children(this.state)).
Planning Advanced Concepts for ReactJS
Advanced Concepts is about 10% of the ReactJS syllabus by topic count — 9 of 93 topics, spread over 3 chapters. At roughly 45 minutes per topic plus 12 minutes per sub-topic, a first pass runs to about 7 hours.
The heaviest chapters are Higher-Order Components (3 topics), Render Props (3 topics), Portals (3 topics) . Front-load those while your energy is high; the short chapters are better revision filler later.
Work top-down: read the chapter, then tick topics off individually rather than marking the whole chapter done. Sub-topics are where silent gaps hide.
Advanced Concepts (ReactJS) FAQ
What is in the ReactJS Advanced Concepts syllabus?
Advanced Concepts is split into 3 chapters — Higher-Order Components, Render Props and Portals, containing 9 topics and 0 sub-topics in total.
How many chapters are there in Advanced Concepts for ReactJS?
3 chapters. Advanced Concepts accounts for about 10% of the topics in the whole ReactJS syllabus (9 of 93).
How long should I spend on Advanced Concepts for ReactJS?
Budget around 7 hours for a first pass through Advanced Concepts — about 45 minutes per topic plus 12 minutes per sub-topic across its 9 topics. Add revision cycles on top.
Are there flashcards for ReactJS Advanced Concepts?
Yes — a 50-card Advanced Concepts deck. Sample cards are printed on this page, and the full deck is free in the Examius app with spaced repetition scheduling.