|
| 1 | +# Usage Guide |
| 2 | + |
| 3 | +# Installation |
| 4 | + |
| 5 | +- Install the Atom package |
| 6 | +- Reload Atom |
| 7 | +- The code snippets are ready to use 🎉 |
| 8 | + |
| 9 | +# Usage |
| 10 | + |
| 11 | +## React |
| 12 | + |
| 13 | +### JavaScript |
| 14 | + |
| 15 | +1. `rimr` (Import React) |
| 16 | + |
| 17 | + ```jsx |
| 18 | + import React from "react"; |
| 19 | + ``` |
| 20 | + |
| 21 | +2. `rimrd` (Import ReactDOM) |
| 22 | + |
| 23 | + ```jsx |
| 24 | + import ReactDOM from "react-dom"; |
| 25 | + ``` |
| 26 | + |
| 27 | +3. `rimrs` (Import React and useState) |
| 28 | + |
| 29 | + ```jsx |
| 30 | + import React, { useState } from "react"; |
| 31 | + ``` |
| 32 | + |
| 33 | +4. `rimrse` (Import React, useState and useEffect) |
| 34 | + |
| 35 | + ```jsx |
| 36 | + import React, { useState, useEffect } from "react"; |
| 37 | + ``` |
| 38 | + |
| 39 | +5. `rfc` (React functional component) |
| 40 | + |
| 41 | + ```jsx |
| 42 | + const Component = () => { |
| 43 | + return <div></div>; |
| 44 | + }; |
| 45 | + export default Component; |
| 46 | + ``` |
| 47 | + |
| 48 | +6. `rue` (useEffect hook) |
| 49 | + |
| 50 | + ```jsx |
| 51 | + useEffect(() => {}, []); |
| 52 | + ``` |
| 53 | + |
| 54 | +7. `rus` (useState hook) |
| 55 | + |
| 56 | + ```jsx |
| 57 | + const [state, setState] = useState(initialValue); |
| 58 | + ``` |
| 59 | + |
| 60 | +8. `ruc` (useContext hook) |
| 61 | + |
| 62 | + ```jsx |
| 63 | + const value = useContext(myContext); |
| 64 | + ``` |
| 65 | + |
| 66 | +9. `rur` (useRef hook) |
| 67 | + |
| 68 | + ```jsx |
| 69 | + const refContainer = useRef(initialValue); |
| 70 | + ``` |
| 71 | + |
| 72 | +### TypeScript |
| 73 | + |
| 74 | +1. `rfcet` (React functional component) |
| 75 | + |
| 76 | + ```tsx |
| 77 | + import React from "react"; |
| 78 | + |
| 79 | + interface Props {} |
| 80 | + |
| 81 | + function Component({}: Props) { |
| 82 | + return <div></div>; |
| 83 | + } |
| 84 | + |
| 85 | + export default Component; |
| 86 | + ``` |
| 87 | + |
| 88 | +2. `ruet` (useEffect hook) |
| 89 | + |
| 90 | + ```tsx |
| 91 | + useEffect(() => {}, []); |
| 92 | + ``` |
| 93 | + |
| 94 | +3. `rust` (useState hook) |
| 95 | + |
| 96 | + ```tsx |
| 97 | + const [state, setState] = useState(initialValue); |
| 98 | + ``` |
| 99 | + |
| 100 | +4. `ruct` (useContext hook) |
| 101 | + |
| 102 | + ```tsx |
| 103 | + const value = useContext(myContext); |
| 104 | + ``` |
| 105 | + |
| 106 | +5. `rurt` (useRef hook) |
| 107 | + |
| 108 | + ```tsx |
| 109 | + const refContainer = useRef(initialValue); |
| 110 | + ``` |
0 commit comments