- Check for an existing
.gitignorefile in the project directory
ls -aA Pen by Tony Brown on CodePen.
React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.
Table of Contents
| import { Component } from "React"; | |
| export var Enhance = ComposedComponent => class extends Component { | |
| constructor() { | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } | |
| render() { |
| Mute these words in your settings here: https://twitter.com/settings/muted_keywords | |
| ActivityTweet | |
| generic_activity_highlights | |
| generic_activity_momentsbreaking | |
| RankedOrganicTweet | |
| suggest_activity | |
| suggest_activity_feed | |
| suggest_activity_highlights | |
| suggest_activity_tweet |
| function getFirstLast(array) { | |
| const { | |
| 0: first, | |
| length: len, | |
| [len - 1]: last | |
| } = array | |
| return {first, last} | |
| } |
| // createContext | |
| const WeatherContext = React.createContext({ day: 3 }) | |
| const App = ({ children }) => { | |
| const [weather, setWeather] = React.useState(null) | |
| const [error, setError] = React.useState(null) | |
| React.useEffect(() => { | |
| api.getWeather(...) | |
| .then(setWeather) | |
| .catch(setError) | |
| }, []) |
| const bigArr = new Array(1000000).fill(1).map((_, i) => i); | |
| bigArr[100] = 5; | |
| const allUnique = arr => { | |
| const all = new Set(); | |
| for (let el of arr) { | |
| if (all.has(el)) { | |
| return false; | |
| } |
| /** Store Data */ | |
| const prices = { | |
| game: 59.95, | |
| nintendo: 399.99, | |
| controller: 49.99, | |
| xbox: 299.99, | |
| ps1: 349.99 | |
| } | |
| const basket = [ |
| function greetCurried(greeting) { | |
| return function(name) { | |
| if (typeof(greeting) !== 'string') { | |
| return ('Greetings!') | |
| } else if (typeof(name) !== 'string') { | |
| return (greeting) | |
| } | |
| return (`${greeting}, ${name}`) | |
| } |