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 { BrowseRotuer as Router, Switch, Route } from 'react-router-dom' | |
import Dashborad from './views/Dashboard.js' | |
function App() { | |
return ( | |
<Router> | |
<Switch> | |
<Route exact path='/dashboard' component={Dashboard} /> |
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 { keys } = Object | |
const { isArray } = Array | |
/** | |
* @param {any} fragment | |
*/ | |
function applyCloningElement(fragment) { | |
if (typeof fragment !== 'object') { | |
return fragment | |
} |
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' | |
const ChildComponent = ({ onPress }) => ( | |
<button onClick={() => onPress('Hola mundo!')}>Click me</button> | |
); | |
// Parent | |
const ParentComponent = () => { | |
const [state, setState] = React.useState(false) |
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 DepartmentButton = ({ onMouseOver }) => { | |
<button onMouseOver={onMouseOver}>Example</button> | |
} | |
const App = () => { | |
const [classList, setClassList] = useState('inactive') | |
function onMouseOverHandler() { | |
if (!isMobileDevice()) { | |
setClassList('activo') | |
} |
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 { Router } from 'express' | |
import fs from 'fs' | |
import multer, { diskStorage } from 'multer' | |
import path from 'path' | |
/** | |
* @description | |
* Allows to control all malicious content via FormData. | |
* @param {{}} file | |
* @param {function} callback |
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, { memo } from 'react' | |
import PropTypes from 'prop-types' | |
import Happy from '../../assets/img/happy.png' | |
const Emoji = ({ type }) => { | |
const icons = new Map([ | |
['happy', { src: Image, width: 300, height: 300, className: '' }], | |
['sad', { src: '', width: 0, height: 300, className: ''] | |
]) |
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 { useMemo } from 'react' | |
const Component = () => { | |
const getColor = useMemo(() => { | |
const colors = ['danger', 'warning', 'secondary] | |
return colors.find((_color, index) => index === step) | |
}, [step]) |
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, useCallback, useMemo } from 'react' | |
/** | |
* | |
* @param {number} initialValue | |
* @param {number} limit | |
*/ | |
function useCounter(initialValue, limit) { | |
const [ state, setState ] = useState({ | |
value: initialValue, |
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
// Para guardar datos necesitas una llave o un nombre para asignarlo en el localStorage | |
// Guardar datos | |
localStorage.setItem('DATOS', JSON.stringify({ nombre: "Anderson", apellido: "Arevalo" })) | |
// El primer argumento guarda la referencia del key, en este caso "DATOS" es nuestro objeto | |
// Para obtener usamos los siguiente |
OlderNewer