Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- What situations would be good to use context?
- Context would be used when one needs to pass down data that needs to be access by several deeply nested components. It's a good way to solve the problem of prop-drilling, where props are passed down through many components in order to reach a great-grandchild component.
- If you need to pass a prop down 1 or 2 levels, is context necessary?
- No. You should start thinking about context when the nested component is 5-6 components deeps. Context should be avoided if you can, because it makes component reuse difficult.
- Can you pass a component instance as a prop to avoid the need for context?
- Yes you can, it's called component composition.
- Can you write your own components that accept render props?
- Yes, this can be done if the child prop needs to communicate with the parent component before rendering.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement