- React Developer Tools
- Dracula DevTools Theme
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 { useField } from '@rocketseat/unform'; | |
import isFunction from 'lodash/isFunction'; | |
import PropTypes from 'prop-types'; | |
import React, { useEffect, useRef, useMemo } from 'react'; | |
import InputMask from 'react-input-mask'; | |
function Input({ name, label, prepend, append, mask, ...rest }) { | |
const ref = useRef(null); | |
const { fieldName, registerField, defaultValue, error } = useField(name); |
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
version: '3' | |
services: | |
postgres: | |
image: postgres | |
environment: | |
- POSTGRES_USER: ${DB_USERNAME} | |
- POSTGRES_PASSWORD: ${DB_PASSWORD} | |
app: | |
build: . |
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
var listElement = document.querySelector("#app ul"); | |
var inputElement = document.querySelector("#app input"); | |
var btnElement = document.querySelector("#app button"); | |
var toDos = JSON.parse(localStorage.getItem("list_todos")) || []; | |
function renderTodos() { | |
listElement.innerHTML = ""; | |
for (todo of toDos) { |
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 axios from 'axios'; | |
import store from '~/store'; | |
const api = axios.create({ | |
baseURL: 'http://localhost:3333', | |
}); | |
api.interceptors.request.use((config) => { | |
const { token } = store.getState().auth; // Aqui poderia ser localStoraget.getItem |
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 PropTypes from 'prop-types'; | |
import { compose } from 'recompose'; | |
import monthNames from '~/util/monthNames'; | |
import 'isomorphic-fetch'; | |
import withLayout from '~/hocs/withLayout'; | |
import withAnalytics from '~/hocs/withAnalytics'; | |
import { Content } from '~/styles/components'; |
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
async approved (data, product, response) { | |
let user = | |
(await User.findBy('email', data.email)) || | |
(await User.findBy('doc', data.doc)) | |
if (!user) { | |
user = await User.create({ | |
email: data.email, | |
doc: data.doc, | |
name: `${data.first_name} ${data.last_name}`.trim() |
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
'use strict' | |
const Database = use('Database') | |
const Model = use('Model') | |
const Env = use('Env') | |
class Course extends Model { | |
static get computed () { | |
return ['thumbnailUrl'] | |
} |
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 { compose, withState, withHandlers } from 'recompose'; | |
const Dropdown = ({ opened, toggleDropdown }) => ( | |
<div> | |
<button type="button" onClick={toggleDropdown}> | |
Abrir/fechar | |
</button> | |
<ul className={`dropdown ${opened ? 'dropdown-open' : ''}`}> | |
<li>ReactJS</li> |
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
function asyncFunction(params, callback, err) { | |
var response = // requisição assíncrona | |
if (response.status === true) { | |
callback(response.data); | |
} else { | |
err(response.data); | |
} | |
} | |
asyncFunction( |
NewerOlder