The useState hook allows us to create state variables in a React function component.
import { useState } from 'react';
package main | |
import ( | |
"crypto/sha256" | |
"encoding/json" | |
"fmt" | |
"strconv" | |
"strings" | |
"time" | |
) |
from hashlib import sha256 | |
import json | |
from time import time | |
class Block: | |
def __init__(self, timestamp=None, data=None): | |
self.timestamp = timestamp or time() | |
self.data = [] if data is None else data |
const https = require('https'); | |
https.get('https://jsonplaceholder.typicode.com/posts', response => { | |
let data = []; | |
const hdrDate = response.headers | |
&& response.headers.date | |
? response.headers.date : 'no response date'; |
Axios is a promise based HTTP client for the browser and Node. Axios makes it easy to send asynchronous HTTP requests to REST API endpoints and perform CRUD (create,read,update,delete) operations. It can be used in vanilla plain JavaScript or with a library such as Vue or React.
npm install axios
pnpm install axios
bower install axios
cURL is a transfer tool used to transfer data from or to a server. It supports various internet protocols of transfer, including: DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP. Using cURL one can perform useful tricks with cURL like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and more.
--request and -X specify a custom request method you can use when communicating with the HTTP server. The specified request method will be used instead of the method otherwise used (which defaults to GET).