reactpractice.dev
@reactpractice.dev
Coding challenges to improve your React skills
Spelling mistakes can make your code look unprofessional.

Instead:
- ✅ use lowercase to name your variables (e.g. `match`) and use uppercase for naming your components - e.g. `Accordion`
- ✅ use camelCase when a name is composed of multiple words - e.g. `isLoading`, `MemoryGame`
March 6, 2025 at 8:37 AM
How would you pass the params for this GET request if you wanted them to be configurable?

Checkout the article for the how to use the URLSearchParams API for this!

https://reactpractice.dev/articles/how-to-pass-query-params-to-a-get-request-with-fetch/
March 4, 2025 at 1:52 PM
msw is great for mocking requests when testing your react components.
Do you use it in your projects?
February 28, 2025 at 11:01 AM
Do you think this snippet throws when the server returns HTTP error code 500?
It doesn't! Instead, `fetch` returns the response `ok` property as `false`, and you need to check for that.
February 27, 2025 at 1:52 PM
How do you type a custom hooks that accepts a generic data type?
When using an arrow function, you can add `<T>` at the beginning of the function:
February 26, 2025 at 1:47 PM
Custom hooks are great at abstracting logic.
What are some custom hooks you built in your projects?
February 25, 2025 at 2:56 PM
How do you pass query string params to a GET request with `fetch`? Use the `URLSearchParams` API!
February 13, 2025 at 1:47 PM