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, useEffect } from 'react' | |
| const removeKeyFromState = (key, setState) => { | |
| setState(({ [key]: deletedKey, ...restKeys }) => ({ ...restKeys })) | |
| } | |
| const useTimeout = () => { | |
| const [timeouts, setTimeouts] = useState({}) | |
| useEffect(() => { |
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
| // Чуть-чуть поменял код отсюда: https://javascript.ru/forum/misc/27347-nadezhnyjj-dvukhstoronnijj-translit.html#post168115 | |
| var transliterate = ( | |
| function() { | |
| var rus = "щ ш ч ц ю я ё ж з ъ ы э а б в г д е з и й к л м н о п р с т у ф х ь".split(/ +/g); | |
| var eng = "shh sh ch cz yu ya yo zh th `` y' e` a b v g d e z i j k l m n o p r s t u f h `".split(/ +/g); | |
| return function(text, engToRus) { | |
| for (var x = 0; x < rus.length; x++) { | |
| text = text.split(engToRus ? eng[x] : rus[x]).join(engToRus ? rus[x] : eng[x]); | |
| text = text.split(engToRus ? eng[x].toUpperCase() : rus[x].toUpperCase()).join(engToRus ? rus[x].toUpperCase() : eng[x].toUpperCase()); |
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"; | |
| class Article extends Component { | |
| constructor(props) { | |
| super(props) | |
| this.state = { | |
| isOpen: props.defaultOpen, | |
| idAd: props.idAd | |
| } |
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
| // in some react class component | |
| handleChangeInput = (e) => { | |
| this.setState({ [e.target.name]: e.target.value }) | |
| } |
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
| for (const a of actions) { | |
| watchers.push(yield createWatcher(a)) | |
| } |
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
| try { | |
| return someUnsafeAction(); | |
| } catch (e) { | |
| console.error(e); | |
| return `Error: ${e.message}`; | |
| } |
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 currentUser = users.find(u => u.id === currentUserId); |
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 from 'react'; | |
| import styled from 'styled-components'; | |
| const Link = styled.a` | |
| display: block; | |
| margin-bottom: 48px; | |
| text-decoration: inherit; | |
| color: inherit; | |
| `; |