docs: useEffect for data fetching section#7490
docs: useEffect for data fetching section#7490GustavEikaas wants to merge 1 commit intoreactjs:mainfrom GustavEikaas:docs/update-useEffect-data-fetching-section
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Hi @GustavEikaas! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Size changesDetails📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
@GustavEikaas Thank you for taking the time to open a PR and think through what might be missing from the docs!
By design, these usage examples are not sufficient. The reference docs are intended to be the minimum needed to describe an API so you can get started using it. The usage examples document common patterns and ways of using the API to help the reader better understand how to use the API. They are not meant to be a example to copy-paste into your app or represent best practices for the surrounding code that isn't directly related to using the API. |
|
I see. Thanks for taking the time to review this pull request 😁 |
Hello!
I was reading the useEffect docs today and I got a bit curious about the useEffect for data fetching scenario.
The way I understand it, this is sort of a 101 section with super simple examples just to teach the users the basics.
However I was wondering if the example provided is sufficient? No loading states, no error states? On the off-chance anyone copies the example and uses it in a codebase it is missing some basic functionality.
I tried to make a change that doesnt overcomplicate the example but also provides the absolute minimum of what you would need should you decide to use a useEffect for data fetching.
Would love to hear your thoughts. I know there are more places further down in the docs that needs to be updated as a result of this but I would love to discuss the changes first. If they are acceptable I will update all places