This file contains hidden or 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 LocalStorage = () => { | |
const [welcome, setWelcome] = useState(""); | |
// Checking if localStorage has a "hasVisited" key else we add "hasVisited" with "lastUpdate" to it | |
useEffect(() => { | |
if (localStorage.getItem("hasVisited")) { | |
setWelcome("Welcome Back!"); | |
} else { |
This file contains hidden or 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 } from "react"; | |
const Checkbox = () => { | |
const [checkbox, setCheckbox] = useState({ | |
autoTrade: false, | |
atRiskPerTrade: "", | |
}); | |
const { autoTrade, atRiskPerTrade } = checkbox; |
This file contains hidden or 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 } from "react"; | |
const Radio = () => { | |
const [radio, setRadio] = useState({ | |
stoplossPercentage: "0.5", | |
}); | |
const { stoplossPercentage } = radio; | |
const onChange = (e) => { | |
setRadio({ [e.target.name]: e.target.value }); |
This file contains hidden or 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 } from "react"; | |
const Select = () => { | |
const [select, setSelect] = useState({ | |
tradeStatus: "", | |
}); | |
const { tradeStatus } = select; | |
const onChange = (e) => { | |
setSelect({ tradeStatus: e.target.value }); |