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
| { | |
| items.map(({ name, tongueWidth, weight } = {}) => ( | |
| <div style={{ margin: '25px 0' }}> | |
| <div>Name: {name}</div> | |
| <div>Width of their tongue: {tongueWidth}cm</div> | |
| <div>Weight: {weight}lbs</div> | |
| </div> | |
| )) | |
| } |
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 hasInvalidChars = /^.*?(?=[\+\^#%&$\*:<>\?/\{\|\}\[\]\)\(]).*$/g.test( | |
| inputValue, | |
| ) | |
| const callApi = async (keywords) => { | |
| try { | |
| const url = `https://someapi.com/v1/search/?keywords=${keywords}/` | |
| return api.searchStuff(url) | |
| } catch (error) { | |
| throw error |
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 hasInvalidChars = /^.*?(?=[\+\^#%&$\*:<>\?/\{\|\}\[\]\\\)\(]).*$/g.test( | |
| inputValue, | |
| ) |
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, { useState, useEffect } from 'react' | |
| const useUploadStuff = () => { | |
| const [files, setFiles] = useState([]) | |
| // Limit the file sizes here | |
| const onChange = (e) => { | |
| const arrFiles = Array.from(e.target.files) | |
| const filesUnder5mb = arrFiles.filter((file) => { | |
| const bytesLimit = 5000000 |
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 someFunction = function() { | |
| const store = { | |
| people: { | |
| joe: { | |
| age: 16, | |
| gender: 'boy', | |
| }, | |
| bob: { | |
| age: 14, | |
| gender: 'transgender', |
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 someFunction = function () { | |
| const store = { | |
| people: { | |
| joe: { | |
| age: 16, | |
| gender: 'boy', | |
| }, | |
| bob: { | |
| age: 14, | |
| gender: 'transgender', |
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
| "TypeError: Cannot read property 'age' of undefined | |
| at tibeweragi.js:24:29 | |
| at https://static.jsbin.com/js/prod/runner-4.1.7.min.js:1:13924 | |
| at https://static.jsbin.com/js/prod/runner-4.1.7.min.js:1:10866" |
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 store = { | |
| people: { | |
| joe: { | |
| age: 16, | |
| gender: 'boy', | |
| }, | |
| bob: { | |
| age: 14, | |
| gender: 'transgender', | |
| } |
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 { useReducer } from 'react' | |
| const initialState = { | |
| // | |
| } | |
| const reducer = (state, action) => { | |
| switch (action.type) { | |
| default: | |
| return state |
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 initialState = {}; const reducer = (state, action)": { | |
| "prefix": "rsr", | |
| "body": [ | |
| "const initialState = {", | |
| " //$1", | |
| "}", | |
| "", | |
| "const reducer = (state, action) => {", | |
| " switch (action.type) {", |