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
// 4 способа копирования объектов: | |
const food = { body: { a: 10 }, beef: '3', bacon: '4', say() { console.log('hi') } } | |
// "Spread" не глубокая копия c методами | |
{ ...food } | |
// RESULT: | |
// { body: {a: 70}, beef: '3', bacon: '4', say() { console.log('hi') } } | |
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://codesandbox.io/s/usetheme-forked-3zp4j?file=/src/index.js | |
import React, { useState } from 'react'; | |
import ReactDOM from 'react-dom'; | |
/* | |
style.scss | |
@mixin variable($variable, $property, $fallback) { | |
// Fallback for browsers that don't support css vars |
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
Show hidden characters
// подключение абсолютных путей для Visual Studio Code. Файл jsconfig.json создать и положить в корень проекта | |
{ | |
"compilerOptions": { | |
"baseUrl": "./src" | |
}, | |
"exclude": [ | |
"node_modules", | |
"**/node_modules/*" | |
] |
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
// Инициализация переменной в корне(если инитить в компоненте или в любой обертке функции работать не будет) | |
export const translationInterface = makeVar({}); | |
/****************************/ | |
// в компоненте получаем данные из query и кладем в рективную переменную | |
import { translationInterface } from "../../../graphql/cache"; | |
// SET dataQueryTranslation to reactive variable |
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
//Чтобы проверить, является ли строка пустой, null или undefined: | |
function isEmpty(str) { | |
return (!str || 0 === str.length); | |
} | |
//Для проверки пустой строки, null или undefined: | |
function isBlank(str) { | |
return (!str || /^\s*$/.test(str)); |
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 hexToRgb = (hex, type = "string") => { | |
if (!hex) | |
{ | |
return false | |
} | |
let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); | |
if (type === "string") |
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
//удобная организация методов с последующим их добавлением в один объект | |
//method_1 | |
const method_1 = (param) => { | |
const someCode = param === param; | |
return { someCode }; |
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://jsfiddle.net/2v3mq3nh/4/ | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<style> |
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 arrs = [ | |
["General Fitness", "Health & Fitness"], | |
["Cardiovascular", "Meditation"], | |
["Health & Fitness", "Cardiovascular", "General Fitness"], | |
["Cardiovascular"] | |
]; | |
const result = [...new Set([].concat(...arrs))]; | |
console.log(result); |
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 } from "react"; | |
import { Button, Modal } from "antd"; | |
const EditModal = ({ children, nameBtn = 'Button', titleModal = 'Modal Title' }) => { | |
const [ modalVisible, setModalVisible ] = useState(false); | |
return ( | |
<> |
NewerOlder