import useAsync from './useAsync';
export const wait5Seconds = new Promise(
resolve => window.setTimeout(resolve, 5000)
)
export default () => {
const { resolve, loading } = useAsync({ promise: wait5Seconds })
This file contains 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 { object, string } from 'yup'; | |
import { useCallback, useMemo } from 'react'; | |
import { Helmet as Metatags } from 'react-helmet'; | |
import useForm from '../../../../macros/form/macro'; | |
import { Text } from 'components/widgets/fields'; | |
export const validationSchema = object().shape({ | |
email: string().trim().min(3).max(255).email().required(), | |
password: string().trim().min(10).max(50).required(), |
This file contains 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 { useCallback, useEffect, useRef, useState } from 'react' | |
import { attempt, fail, getInitialState, succeed } from './reducers' | |
import { Validity } from './helpers' | |
export default ({ promise }) => { | |
const { current: controller } = useRef(new AbortController()) | |
const [state, setState] = useState(getInitialState()) | |
const resolve = useCallback( |
This file contains 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
{ | |
"interview": { | |
"id": "9771aaf8-eafc-4658-b8ab-1b9eecf2f368", | |
"candidate": { | |
"id": "80959d1e-c507-49a2-b965-b3667c7eed48", | |
"firstName": "Fernando", | |
"lastName": "Camargo", | |
"headLine": "Senior Front End", | |
"photo": {} | |
}, |
This file contains 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 LOCAL = { email: "njr@gmail.com", expiredPassword: true }; | |
const DB = { | |
preferences: { optIn: false }, | |
notifications: { duplicated: true, something: true, fake: false }, | |
bills: [1] | |
}; | |
const response = (type, res, params) => | |
console.log(JSON.stringify({ response: { type, res, params } }, null, 2)); |
This file contains 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 URL = 'domain.com/x/y/z' | |
const PARAMS = { | |
firstname: 'firstName', | |
lastname: 'lastName', | |
phone: 'phone', | |
company: 'company', | |
} | |
const concat = ({ |
This file contains 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 content = [ | |
{ label: 'Item 1' }, | |
{ | |
label: 'Item 2', | |
children: [ | |
{ label: 'Item 2.1' }, | |
{ label: 'Item 2.2' }, | |
{ | |
label: 'Item 2.3', | |
children: [ |
This file contains 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 { useForm } from 'hooks'; | |
import settings from './form-settings'; | |
const App = () => { | |
const { | |
components: { Form, Submit }, | |
elements: { |
This file contains 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 translations = { | |
x: 'coord_x', | |
y: 'coord_y', | |
CodClient: 'id' | |
}; | |
const vetor = [ | |
{ x: 0, y: 1 }, | |
{ x: 2, y: 1 }, | |
{ x: 4, y: 3 } |
This file contains 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 DeviceIMEI = require("react-native-imei"); | |
const formatIMEI = imei => | |
String(imei).replace(/(\d{4})?(\d{4})?(\d{4})?(\d{2})/, "$1.$2.$3.$4-"); | |
const getDeviceIMEI = () => { | |
return DeviceIMEI.getImei().then(imeiList => { | |
const [IMEI_1, IMEI_2] = imeiList.map(formatIMEI); | |
this.setState({ IMEI_1, IMEI_2 }); |