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 AWS from "aws-sdk"; | |
import { useState } from "react"; | |
function App() { | |
// Create state to store file | |
const [file, setFile] = useState(null); | |
// Function to upload file to s3 | |
const uploadFile = async () => { | |
// S3 Bucket 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
const uploadFile = async () => { | |
const S3_BUCKET = "bucket-name"; | |
const REGION = "region"; | |
AWS.config.update({ | |
accessKeyId: "youraccesskeyhere", | |
secretAccessKey: "yoursecretaccesskeyhere", | |
}); | |
const s3 = new AWS.S3({ | |
params: { Bucket: S3_BUCKET }, |
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 { useState } from "react"; | |
function App() { | |
const [file, setFile] = useState(null); | |
const handleFileChange = (e) => { | |
const file = e.target.files[0]; | |
setFile(file); | |
}; | |
return ( | |
<div className="App"> |
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
[ | |
{ | |
"AllowedHeaders": [ | |
"*" | |
], | |
"AllowedMethods": [ | |
"PUT", | |
"POST", | |
"DELETE", | |
"GET" |
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": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "PublicListGet", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": [ | |
"s3:List*", | |
"s3:Get*" |
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 Cookies from "js-cookie"; | |
function App() { | |
// Method to set data in cookies which will expire in 7 days | |
const SetCookie = () => { | |
Cookies.set("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", { | |
expires: 7, | |
}); | |
}; |
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 Stopwatch from "./Stopwatch"; | |
function App() { | |
return ( | |
<div className="App"> | |
<Stopwatch /> | |
</div> | |
); | |
} |
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
body { | |
background-color: #000; | |
} | |
.stopwatch-time { | |
text-align: center; | |
color: #fff; | |
font-size: 80px; | |
} |
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, { useState, useEffect } from "react"; | |
import "./stopwatch.css"; | |
const Stopwatch = () => { | |
// state to store time | |
const [time, setTime] = useState(0); | |
// state to check stopwatch running or not | |
const [isRunning, setIsRunning] = useState(false); | |
useEffect(() => { |
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, { useState, useEffect } from "react"; | |
const App = () => { | |
const [posts, setPosts] = useState([]); | |
const getData = () => { | |
var requestOptions = { | |
method: "GET", | |
redirect: "follow", | |
}; |
NewerOlder