The React snippet collection contains function components and reusable hooks for React 16.
Renders a table with rows dynamically created from an array of objects and a list of property names.
React, Components · Sep 6, 2020
Renders a countdown timer that prints a message when it reaches zero.
React, Components · Oct 13, 2021
As powerful as React is, it is also quite fragile at places. Did you know that just a few lines are more than enough to break your entire React application?
React, Debugging · Nov 6, 2021
When working with state in your code, you often run into issues with maintaining complexity and readability. Oftentimes, these issues are easily fixable.
React, Logic · Jun 12, 2021
Tracks the browser's location hash value, and allows changing it.
React, Hooks · Oct 2, 2021
Handles the event of hovering over the wrapped component.
React, Hooks · Oct 5, 2021
Returns a stateful value, persisted in localStorage
, and a function to update it.
React, Hooks · Oct 13, 2021
Wrapping your mind around React hooks and how they interact with setInterval()
can be difficult. Here's a guide to get you started.
React, Hooks · Sep 28, 2021
Renders an uncontrolled <select>
element that uses a callback function to pass its value to the parent component.
React, Components · Nov 25, 2020
Listens for changes in the pressed state of a given key.
React, Hooks · Sep 7, 2021
Testing Redux-connected components with React Testing Library is a very common scenario. Learn how to use this simple utility function to speed up your testing.
React, Testing · Nov 7, 2021
Testing stateful React components is by no means a difficult task, but did you know there is an elegant solution that doesn't involve testing state directly?
React, Testing · Jun 12, 2021