![Logo](/logo.png) # 30 seconds of React > Curated collection of useful React snippets that you can understand in 30 seconds or less. - Use Ctrl + F or command + F to search for a snippet. - Contributions welcome, please read the [contribution guide](CONTRIBUTING.md). - Snippets are written in React 16.8+, using hooks. ### Prerequisites To import a snippet into your project, you must import `React` and copy-paste the component's JavaScript code like this: ```js import React from 'react'; function MyComponent(props) { /* ... */ } ``` If there is any CSS related to your component, copy-paste it to a new file with the same name and the appropriate extension, then import it like this: ```js import './MyComponent.css'; ``` To render your component, make sure there is a node with and id of `"root"` present in your element (preferrably a `
`) and that you have imported `ReactDOM`, like this: ```js import ReactDOM from 'react-dom'; ``` #### Related projects - [30 Seconds of Code](https://30secondsofcode.org) - [30 Seconds of CSS](https://30-seconds.github.io/30-seconds-of-css/) - [30 Seconds of Interviews](https://30secondsofinterviews.org/) ## Table of Contents ### Array
View contents * [`DataList`](#datalist) * [`DataTable`](#datatable) * [`MappedTable`](#mappedtable)
### Hooks
View contents * [`useClickInside`](#useclickinside) * [`useClickOutside`](#useclickoutside) * [`useFetch`](#usefetch) * [`useInterval`](#useinterval) * [`useSSR`](#usessr) * [`useTimeout`](#usetimeout)
### Input
View contents * [`ControlledInput`](#controlledinput) * [`LimitedTextarea`](#limitedtextarea) * [`LimitedWordTextarea`](#limitedwordtextarea) * [`MultiselectCheckbox`](#multiselectcheckbox) * [`PasswordRevealer`](#passwordrevealer) * [`Select`](#select) * [`Slider`](#slider) * [`TextArea`](#textarea) * [`UncontrolledInput`](#uncontrolledinput)
### Visual
View contents * [`Accordion`](#accordion-) * [`AutoLink`](#autolink-) * [`Carousel`](#carousel) * [`Collapse`](#collapse) * [`CountDown`](#countdown-) * [`FileDrop`](#filedrop) * [`Mailto`](#mailto) * [`Modal`](#modal) * [`StarRating`](#starrating) * [`Tabs`](#tabs) * [`Ticker`](#ticker) * [`Toggle`](#toggle) * [`Tooltip`](#tooltip) * [`TreeView`](#treeview-)
--- ## Array ### DataList Renders a list of elements from an array of primitives. - Use the value of the `isOrdered` prop to conditionally render a `
    ` or `