Skip to content

Instantly share code, notes, and snippets.

@KristofferTolboll2
Created March 29, 2021 15:30
Show Gist options
  • Select an option

  • Save KristofferTolboll2/c61c3f9e64c87e43d3f3629216df9037 to your computer and use it in GitHub Desktop.

Select an option

Save KristofferTolboll2/c61c3f9e64c87e43d3f3629216df9037 to your computer and use it in GitHub Desktop.
import _ as moment from 'moment';
export default function DailyReward(prosp) {
const [isShowModal, setIsShowModal] = useState<boolean>(false);
const [isRewardAvailible, setIsRewardAailible = useState<boolean>(false);
const [timeLeft, setTimeLeft] = useState(0) //in miliseconds
const [reward, setReward] = useState()
useEffect(() =>{
//fetch data
}, [])
const submitRewardHandler = () =>{
axios.post(...).then(res =>{
setReward(res.data)
}
const parsedTime = moment(timeLeft).format('HH:mm*)
return (
{timeleft && <div> {parsedTime} </div> }
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment