Skip to content

Instantly share code, notes, and snippets.

View juulhao's full-sized avatar
👨‍💻
Just do it. After do better!

Julio Rodrigues juulhao

👨‍💻
Just do it. After do better!
View GitHub Profile
@juulhao
juulhao / user.js
Created August 8, 2017 16:39 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@juulhao
juulhao / gist:f42a80fd8c28575152ae3bcd92184826
Created March 8, 2019 19:05
refresh fetch and caching
import React, { Component } from 'react';
import logo from './assets/images/logo.svg';
import './App.css';
import { Fetch } from 'react-data-fetching'
import api from './utils/api';
import CardClima from './components/CardClima';
class App extends Component {
constructor(props){