diff --git a/.eslintrc b/.eslintrc
index 2f6ed9f..de8925d 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -6,6 +6,7 @@
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
+ "react/jsx-filename-extension": 0,
"no-unused-expressions": [ 2,{
"allowShortCircuit": true,
}],
diff --git a/.npmignore b/.npmignore
index fc1fdee..bc8df55 100644
--- a/.npmignore
+++ b/.npmignore
@@ -5,7 +5,6 @@ build
!.eslintrc
yarn-error.log
dev-dist
-readme-images
*.js
!dist/index.js
diff --git a/app/App.js b/app/App.js
index 6342fa4..16ea090 100644
--- a/app/App.js
+++ b/app/App.js
@@ -1,6 +1,7 @@
import React from 'react';
import { useTimer } from '../src/index';
+
function MyTimer({ expiryTimestamp }) {
const {
seconds,
@@ -10,36 +11,41 @@ function MyTimer({ expiryTimestamp }) {
start,
pause,
resume,
- restart
+ restart,
} = useTimer({ expiryTimestamp, onExpire: () => console.warn('onExpire called') });
return (
-
+
react-timer-hook
Timer Demo
-
+
{days}:{hours}:{minutes}:{seconds}
-
-
-
-
+
+
+
+
);
}
export default function App() {
- var t = new Date();
- t.setSeconds(t.getSeconds() + 600); // 10 minutes timer
+ const time = new Date();
+ time.setSeconds(time.getSeconds() + 600); // 10 minutes timer
return (
-
+
);
}
diff --git a/readme-images/useStopwatch.gif b/readme-images/useStopwatch.gif
deleted file mode 100644
index ba075d6..0000000
Binary files a/readme-images/useStopwatch.gif and /dev/null differ
diff --git a/readme-images/useTime.gif b/readme-images/useTime.gif
deleted file mode 100644
index 9bec953..0000000
Binary files a/readme-images/useTime.gif and /dev/null differ
diff --git a/readme-images/useTimer.gif b/readme-images/useTimer.gif
deleted file mode 100644
index 45b658c..0000000
Binary files a/readme-images/useTimer.gif and /dev/null differ
diff --git a/readme.md b/readme.md
index 6dcb02a..facc91f 100644
--- a/readme.md
+++ b/readme.md
@@ -56,20 +56,20 @@ function MyTimer({ expiryTimestamp }) {
+ const time = new Date();
+ time.setSeconds(time.getSeconds() + 300);
+ restart(time)
+ }}>Restart
);
}
export default function App() {
- var t = new Date();
- t.setSeconds(t.getSeconds() + 600); // 10 minutes timer
+ const time = new Date();
+ time.setSeconds(time.getSeconds() + 600); // 10 minutes timer
return (
-
+
);
}