- Notifications
You must be signed in to change notification settings - Fork 733
create example-react-hooks-useContext #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
simple test example to test if a child component can update the context state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me, but we should add jsx
to the codefences so we get syntax highlighting:
```js code... ```
One comment - naming the inner component
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nitpicks:
- use flat folder structure (nesting is not necessary for this example)
- consistent import from react (sometimes React.createContext, sometimes import { useContext } from 'react'
removed semi colons
changed child component name and added brief description of test.
@kentcdodds @eps1lon @alexkrolick @afontcu Made changes based on feedback let me know what you think. |
@afontcu Made changes based on feedback let me know what you think. |
Co-Authored-By: Adrià Fontcuberta <afontcu@gmail.com>
Co-Authored-By: Adrià Fontcuberta <afontcu@gmail.com>
@afontcu was able to make the changes let me know what you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great from here, thank you very much for this 😄
Co-Authored-By: Adrià Fontcuberta <afontcu@gmail.com>
Co-Authored-By: Adrià Fontcuberta <afontcu@gmail.com>
I've cleaned up the file a bit (whitespacing, naming, etc), but I'd love someone else to check that the actual example test makes sense (from a React/useContext point of view). Not sure if using it with Your call! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to link this page to the wrapper
docs to show how to deal with Context providers when you aren't rendering a whole app. We also need to add an entry in the navigation tree for this page.
simple test example to test if a child component can update the context state.