-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shibi Suriya
committed
Oct 2, 2023
1 parent
ed0eb50
commit 8c558ce
Showing
14 changed files
with
344 additions
and
254 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { useEffect, useState, useRef } from 'react'; | ||
|
||
function Test() { | ||
// const [count, setCount] = useState(0); | ||
const counterRef = useRef(10); | ||
|
||
useEffect(() => { | ||
const timer = setInterval(() => { | ||
console.log(Date.now(), ' Hello from inside of the timer. count => ', counterRef.current); | ||
}, 500); | ||
return () => { | ||
clearInterval(timer); | ||
}; | ||
}, []); | ||
|
||
const increment = () => { | ||
counterRef.current++; | ||
}; | ||
|
||
return ( | ||
<div> | ||
<h1>count: {counterRef.current}</h1> | ||
<button onClick={increment}>++</button> | ||
</div> | ||
); | ||
} | ||
|
||
export default Test; |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
export { useFood } from './useFood'; | ||
export { useDirection } from './useDirection'; | ||
export { useSnakes } from './useSnakes'; | ||
export { useInput } from './useInput'; | ||
export { useSocket } from './useSocket'; | ||
export { useTicks } from './useTicks'; |
Oops, something went wrong.