React: Unexpected use of 'location';
Solution: Use window.location
instead of bare location
.
// Lists of countries with ISO 3166 codes, presented in various formats. | |
// Last Updated: July 30, 2020 | |
// If you're using PHP, I suggest checking out: | |
// https://github.com/thephpleague/iso3166 | |
// or Laravel: https://github.com/squirephp/squire | |
// | |
// JS developers can check out: | |
// https://www.npmjs.com/package/iso3166-2-db | |
// |
React: Unexpected use of 'location';
Solution: Use window.location
instead of bare location
.
/** | |
* These hooks re-implement the now removed useBlocker and usePrompt hooks in 'react-router-dom'. | |
* Thanks for the idea @piecyk https://github.com/remix-run/react-router/issues/8139#issuecomment-953816315 | |
* Source: https://github.com/remix-run/react-router/commit/256cad70d3fd4500b1abcfea66f3ee622fb90874#diff-b60f1a2d4276b2a605c05e19816634111de2e8a4186fe9dd7de8e344b65ed4d3L344-L381 | |
*/ | |
import { useContext, useEffect, useCallback } from 'react'; | |
import { UNSAFE_NavigationContext as NavigationContext } from 'react-router-dom'; | |
/** | |
* Blocks all navigation attempts. This is useful for preventing the page from | |
* changing until some condition is met, like saving form data. |