Skip to content

Commit 9bf1afa

Browse files
committed
minor changes in App.js
1 parent 5e51ed4 commit 9bf1afa

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"rules": {
77
"react-hooks/rules-of-hooks": "error",
88
"react-hooks/exhaustive-deps": "warn",
9+
"react/jsx-filename-extension": 0,
910
"no-unused-expressions": [ 2,{
1011
"allowShortCircuit": true,
1112
}],

app/App.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { useTimer } from '../src/index';
33

4+
45
function MyTimer({ expiryTimestamp }) {
56
const {
67
seconds,
@@ -10,32 +11,37 @@ function MyTimer({ expiryTimestamp }) {
1011
start,
1112
pause,
1213
resume,
13-
restart
14+
restart,
1415
} = useTimer({ expiryTimestamp, onExpire: () => console.warn('onExpire called') });
1516

1617

1718
return (
18-
<div style={{textAlign: 'center'}}>
19+
<div style={{ textAlign: 'center' }}>
1920
<h1>react-timer-hook </h1>
2021
<p>Timer Demo</p>
21-
<div style={{fontSize: '100px'}}>
22+
<div style={{ fontSize: '100px' }}>
2223
<span>{days}</span>:<span>{hours}</span>:<span>{minutes}</span>:<span>{seconds}</span>
2324
</div>
24-
<button onClick={start}>Start</button>
25-
<button onClick={pause}>Pause</button>
26-
<button onClick={resume}>Resume</button>
27-
<button onClick={() => {
28-
// Restarts to 5 minutes timer
29-
var t = new Date();
30-
t.setSeconds(t.getSeconds() + 300);
31-
restart(t)
32-
}}>restart</button>
25+
<button type="button" onClick={start}>Start</button>
26+
<button type="button" onClick={pause}>Pause</button>
27+
<button type="button" onClick={resume}>Resume</button>
28+
<button
29+
type="button"
30+
onClick={() => {
31+
// Restarts to 5 minutes timer
32+
const t = new Date();
33+
t.setSeconds(t.getSeconds() + 300);
34+
restart(t);
35+
}}
36+
>
37+
Restart
38+
</button>
3339
</div>
3440
);
3541
}
3642

3743
export default function App() {
38-
var t = new Date();
44+
const t = new Date();
3945
t.setSeconds(t.getSeconds() + 600); // 10 minutes timer
4046
return (
4147
<div>

0 commit comments

Comments
 (0)