mirror of
https://github.com/streamich/react-use.git
synced 2025-12-08 18:02:14 +00:00
Merge pull request #741 from streamich/update-yarn-lock
feat: recreate yarn.lock
This commit is contained in:
commit
ced3556865
@ -46,13 +46,13 @@
|
||||
},
|
||||
"homepage": "https://github.com/streamich/react-use#readme",
|
||||
"dependencies": {
|
||||
"copy-to-clipboard": "^3.1.0",
|
||||
"nano-css": "^5.1.0",
|
||||
"copy-to-clipboard": "^3.2.0",
|
||||
"nano-css": "^5.2.1",
|
||||
"react-fast-compare": "^2.0.4",
|
||||
"resize-observer-polyfill": "^1.5.1",
|
||||
"screenfull": "^5.0.0",
|
||||
"set-harmonic-interval": "^1.0.1",
|
||||
"throttle-debounce": "^2.0.1",
|
||||
"throttle-debounce": "^2.1.0",
|
||||
"ts-easing": "^0.2.0",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
@ -103,7 +103,7 @@
|
||||
"semantic-release": "15.13.30",
|
||||
"ts-loader": "6.2.1",
|
||||
"ts-node": "8.4.1",
|
||||
"tslint": "5.20.0",
|
||||
"tslint": "6.0.0-beta0",
|
||||
"tslint-config-prettier": "1.18.0",
|
||||
"tslint-eslint-rules": "5.4.0",
|
||||
"tslint-plugin-prettier": "2.0.1",
|
||||
|
||||
@ -6,9 +6,9 @@ describe('useTitle', () => {
|
||||
expect(useTitle).toBeDefined();
|
||||
});
|
||||
|
||||
const hook = renderHook(props => useTitle(props), { initialProps: 'My page title' });
|
||||
|
||||
it('should update document title', () => {
|
||||
const hook = renderHook(props => useTitle(props), { initialProps: 'My page title' });
|
||||
|
||||
expect(document.title).toBe('My page title');
|
||||
hook.rerender('My other page title');
|
||||
expect(document.title).toBe('My other page title');
|
||||
|
||||
@ -10,7 +10,7 @@ interface Store<Action, State> {
|
||||
|
||||
type Middleware<Action, State> = (store: Store<Action, State>) => (next: Dispatch<Action>) => (action: Action) => void;
|
||||
|
||||
function composeMiddleware<Action, State>(chain: Array<Middleware<Action, State>>) {
|
||||
function composeMiddleware<Action, State>(chain: Middleware<Action, State>[]) {
|
||||
return (context: Store<Action, State>, dispatch: Dispatch<Action>) => {
|
||||
return chain.reduceRight((res, middleware) => {
|
||||
return middleware(context)(res);
|
||||
@ -18,7 +18,7 @@ function composeMiddleware<Action, State>(chain: Array<Middleware<Action, State>
|
||||
};
|
||||
}
|
||||
|
||||
const createReducer = <Action, State>(...middlewares: Array<Middleware<Action, State>>) => {
|
||||
const createReducer = <Action, State>(...middlewares: Middleware<Action, State>[]) => {
|
||||
const composedMiddleware = composeMiddleware<Action, State>(middlewares);
|
||||
|
||||
return (
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useRef } from 'react';
|
||||
|
||||
const useTitle = (title: string) => {
|
||||
useEffect(() => {
|
||||
document.title = title;
|
||||
}, [title]);
|
||||
const t = useRef<string>();
|
||||
|
||||
if (t.current !== title) {
|
||||
document.title = t.current = title;
|
||||
}
|
||||
};
|
||||
|
||||
export default useTitle;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
const parseTimeRanges = ranges => {
|
||||
const result: Array<{ start: number; end: number }> = [];
|
||||
const result: { start: number; end: number }[] = [];
|
||||
|
||||
for (let i = 0; i < ranges.length; i++) {
|
||||
result.push({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user