This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // basic uses | |
| // user component using useState | |
| const User = () => { | |
| const [userDetails, setUserdetails] = useState(); | |
| const [loading, setLoading] = useState(false); | |
| const [error, setError] = useState(); | |
| useEffect(() => { | |
| setLoading(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let cars = [ | |
| { | |
| "color": "purple", | |
| "type": "minivan", | |
| "registration": new Date('2017-01-03'), | |
| "capacity": 7 | |
| }, | |
| { | |
| "color": "red", | |
| "type": "station wagon", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // src/App.js | |
| import React from "react"; | |
| const UserContext = React.createContext(); | |
| export default function App() { | |
| const user = { name: "Reed" }; | |
| return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const arr = [1, 1, 12, 4, 4, true, false, true, null]; | |
| const filteredArr = [...new Set(arrr)] | |
| // result: [1, 12, 4, true, false, null] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### DigitalOcean Ubuntu 18.04 x64 + Rails 5 + Nginx + Unicorn + PostgreSQL9.6 + Capistrano 3 | |
| SSH into Root | |
| $ ssh [email protected] | |
| Change Root Password | |
| $ passwd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var arr = [ | |
| {'id':1 ,'parentid' : 0}, | |
| {'id':2 ,'parentid' : 1}, | |
| {'id':3 ,'parentid' : 1}, | |
| {'id':4 ,'parentid' : 2}, | |
| {'id':5 ,'parentid' : 0}, | |
| {'id':6 ,'parentid' : 0}, | |
| {'id':7 ,'parentid' : 4} | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import styled from 'styled-components'; | |
| export default class Tab extends Component { | |
| constructor(props) { | |
| super(props); | |
| console.log(this.props); | |
| this.state = { | |
| activeTabIndex: 1 |