diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e7e82126a..f4f398398 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ Here's what you can do to help: - All snippet titles must be prefixed with `###` and be at the very first line of your snippet. - Snippet titles must be unique (although if you cannot find a better title, just add some placeholder at the end of the filename and title and we will figure it out). - Follow snippet titles with an empty line. -- **Snippet descriptions** must be short and to the point. Try to explain *what* the snippet does and *how* the snippet works and what Javascript/React features are used. Remember to include what functions you are using and why. +- **Snippet descriptions** must be short and to the point. Try to explain _what_ the snippet does and _how_ the snippet works and what Javascript/React features are used. Remember to include what functions you are using and why. - Follow snippet descriptions with an empty line. - **Snippet code** must be enclosed inside ` ```jsx ` and ` ``` `. - If your snippet is accompanied by CSS code, enclose it inside ` ```css ` and ` ``` ` and present it before the JS/JSX code. @@ -31,8 +31,8 @@ Here's what you can do to help: - All snippets must be followed by one (more if necessary) test case after the code, in a new block enclosed inside ` ```jsx ` and ` ``` `. The syntax for this is `ReactDOM.render(, document.getElementById("root"));`. Use multiline examples only if necessary. - Try to make your component name unique, so that it does not conflict with existing snippets. - Snippets should be as brief as possible, without sacrificing functionality. If your snippet seems longer than most, you can still submit it, and we can help you shorten it or figure out ways to improve it. -- Snippets *should* solve real-world problems, no matter how simple. -- Snippets *should* be abstract enough to be applied to different scenarios. +- Snippets _should_ solve real-world problems, no matter how simple. +- Snippets _should_ be abstract enough to be applied to different scenarios. - You can start creating a new snippet, by using the [snippet template](snippet-template.md) to format your snippets. ### Additional guidelines and conventions regarding snippets @@ -78,4 +78,4 @@ Here's what you can do to help: - Use semicolons whenever necessary. - Leave a single space after a comma (`,`) character. - Try to strike a balance between readability, brevity, and performance. -- Never use `eval()`. Your snippet will be disqualified immediately. \ No newline at end of file +- Never use `eval()`. Your snippet will be disqualified immediately. diff --git a/README.md b/README.md index 0918b5193..828b961da 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,14 @@ > 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. +- 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'; @@ -20,89 +21,86 @@ 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/) +- [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) -
- +- [DataList](#datalist) +- [DataTable](#datatable) +- [MappedTable](#mappedtable) + ### Input
View contents -* [Input](#input) -* [LimitedTextarea](#limitedtextarea) -* [LimitedWordTextarea](#limitedwordtextarea) -* [MultiselectCheckbox](#multiselectcheckbox) -* [PasswordRevealer](#passwordrevealer) -* [Select](#select) -* [TextArea](#textarea) -
- +- [Input](#input) +- [LimitedTextarea](#limitedtextarea) +- [LimitedWordTextarea](#limitedwordtextarea) +- [MultiselectCheckbox](#multiselectcheckbox) +- [PasswordRevealer](#passwordrevealer) +- [Select](#select) +- [TextArea](#textarea) + ### Object
View contents -* [TreeView](#treeview) -
- +- [TreeView](#treeview) + ### String
View contents -* [AutoLink](#autolink) -
- +- [AutoLink](#autolink) + ### Visual
View contents -* [Carousel](#carousel) -* [Collapse](#collapse) -* [CountDown](#countdown) -* [FileDrop](#filedrop) -* [Mailto](#mailto) -* [StarRating](#starrating) -* [Tab](#tab) -* [Ticker](#ticker) -* [Toggle](#toggle) -* [Tooltip](#tooltip) -
- +- [Carousel](#carousel) +- [Collapse](#collapse) +- [CountDown](#countdown) +- [FileDrop](#filedrop) +- [Mailto](#mailto) +- [StarRating](#starrating) +- [Tab](#tab) +- [Ticker](#ticker) +- [Toggle](#toggle) +- [Tooltip](#tooltip) + --- ## Array + ### DataList Renders a list of elements from an array of primitives. @@ -113,9 +111,7 @@ Omit the `isOrdered` prop to render a `