Skip to content

Commit

Permalink
Use stable cache variable on subsequent runs of useTranslate (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpriour authored and DenysVuika committed Jan 7, 2020
1 parent a16d558 commit 268e8ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/useTranslate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function useTranslate(
translations?: LanguageData
) {
options = Object.assign({}, defaultOptions, options);
cache = translations || {};
cache = translations || cache;

const [lang, setLang] = useState(options.lang);
const [data, setData] = useState(cache);
Expand Down

0 comments on commit 268e8ae

Please sign in to comment.