Created
January 26, 2021 05:27
-
-
Save KevDev90/fd1867bddf5672439c63ec71e624e7b9 to your computer and use it in GitHub Desktop.
Context q&a's
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What situations would be good to use context? | |
Context is very useful when you have global data that is not very complex. Examples could be showing the authenticated user at the top, the content of the cart or the selected language, or global switches such as selected language or color theme. | |
If you need to pass a prop down 1 or 2 levels, is context necessary? | |
No, for only going down 1 or 2 levels I believe just passing state via props will suffice. | |
Can you pass a component instance as a prop to avoid the need for context? | |
Yes, by creating a HoC component with context. | |
Can you write your own components that accept render props? | |
Yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment