Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyoshiaki committed Jul 11, 2019
2 parents 5c401dd + b58fcf4 commit 267eb8e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hooks/useSelectorRef.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { useSelector } from "react-redux";
import { useRef, useEffect } from "react";

export default function useSelectorRef<T>(selector: (state: any) => T) {
const ref = useRef<T>();
const select = useSelector(selector);
const ref = useRef<T>(select);

useEffect(() => {
ref.current = select;
}, [select]);
Expand Down

0 comments on commit 267eb8e

Please sign in to comment.