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 { useState, useRef, useEffect, useCallback } from "react"; | |
// использование | |
function App() { | |
// состояние для хранения координат курсора | |
const [coords, setCoords] = useState({ x: 0, y: 0 }); | |
// обработчик событий обернут в useCallback, | |
// поэтому ссылка никогда не изменится | |
const handler = useCallback( |
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 { useState } from "react"; | |
// использование | |
function App() { | |
// аналогично useState, но первым аргументом является ключ значения, хранящегося в локальном хранилище | |
const [name, setName] = useLocalStorage("name", "Igor"); | |
return ( | |
<div> | |
<input |
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
{ | |
"files.autoSave": "onFocusChange", | |
"explorer.confirmDelete": false, | |
"editor.fontFamily": "Victor Mono", | |
"editor.fontWeight": "600", | |
"editor.fontSize": 15, | |
"editor.fontLigatures": true, | |
"editor.lineHeight": 16, | |
"editor.tokenColorCustomizations": { | |
"textMateRules": [ |
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
function foo() { | |
function nextState(v) { | |
switch (state) { | |
case 0: | |
state++; | |
return 42; // yield | |
case 1: | |
state++; | |
x = v; // yield ended | |
console.log(x); |
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 = [1, 2, 3]; | |
var greeting = "hello world"; | |
var m = new Map(); | |
m.set("foo", 42); | |
m.set({cool: true}, "hello world"); | |
var it = arr[Symbol.iterator](); | |
it.next(); | |
it.next(); | |
it.next(); |
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
:root { | |
--background-color: #ccc; | |
} | |
html, body { | |
heigth: 100%; | |
weight: 100%; | |
padding: 0; | |
margin: 0; | |
background: var(--background-color); |
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
(function (window) { | |
var app = { | |
defaults: { | |
layout: '#layout' | |
}, | |
init: function (opts) { | |
new TabsView(); | |
new SearchView(); |
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
{ | |
"name": "ProjectName", | |
"description": "Site packages list", | |
"require": { | |
"codeigniter": "3.1.3", | |
"mdl": "1.1.3", | |
"react": "15", | |
"react-dom": "15", | |
"jquery": "1.12.0", | |
"underscorejs": "1.8.3", |