Rendering, hooks, state, effects, performance and the mental model behind them.
Write mergeDefaultProps(props, defaults). It returns a new plain object
that has every key from defaults, overridden by any key present in
props whose value is not undefined. Neither input object should be
mutated. This is the logic behind default props: a caller who does not
Write buildClassName(base, conditional). base is a string (possibly
with several space-separated classes). conditional is an object mapping
class name to a boolean. Return a single space-separated class string
containing base's classes followed by every key of conditional whose
Write flattenChildren(children). children is a JSON value shaped like
props.children can be: a single value, or arrays nested to any depth
(because {list.map(...)} and adjacent expressions produce nested
arrays). Return a flat array containing every leaf value in order, except
Write validateRequiredProps(schema, props). schema is an object
mapping prop name to a spec { required: boolean, type: "string" | "number" | "boolean" | "function" | "object" }. props is the object
actually passed to the component. Return a sorted array of human-readable
In plain terms: what is a React component, and what are props? Give me a concrete example of a parent handing something to a child.
You write <Card title="Hi">text</Card> in a .jsx file. What does that
line actually turn into when the code runs, and why does a component have
to return a single root node?