Skip to content

Instantly share code, notes, and snippets.

View JoaoVictor6's full-sized avatar
:octocat:
Busy

João Victor JoaoVictor6

:octocat:
Busy
View GitHub Profile
@JoaoVictor6
JoaoVictor6 / index.tsx
Created March 25, 2022 18:00
basic timer with react
function App() {
const [timer, setTimer] = useState(60)
const [pause, setPause] = useState(false)
const minute = Math.floor(timer/60)
const seconds = timer%60
useEffect(() => {
setTimeout(() => {
if(timer === 0){
const btnAdd = document.querySelector('#adicionar')
const list= document.getElementById('lista')
const listForOutput = []
function adicionar(){
const text = document.getElementById('text').value
const li = `
<li>