-
-
Save mfrancois3k/eae12f315a3f6734008f4bf58cf54d4d to your computer and use it in GitHub Desktop.
React timer Modal
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 _ 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