export const createHistory = function(){ return useQueries(createHistoryFn)({ stringifyQuery(ob){ return qs.stringify(ob, {encode:true}) }, parseQueryString(str){ return qs.parse(str) } }) }
getUserConfirmation(message, callback) { callback(window.confirm(message)) // The default behavior } }) } { let history = useBeforeUnload(createHistory)() history.listenBeforeUnload(function() { return 'Are you sure you want to leave this page?' }) } { let history = useQueries(createHistory)() history.listen(function(location) { console.log(location.query) }) } { let history = useQueries(createHistory)({ parseQueryString: function(queryString) { // TODO: return a parsed version of queryString return {}; }, stringifyQuery: function(query) { // TODO: return a query string created from query return "";
import { createHistory, useQueries } from 'history' const history = useQueries(createHistory)(); export default history;
getUserConfirmation(message, callback) { callback(window.confirm(message)) // The default behavior } }) } { let history = useBeforeUnload(createBrowserHistory)() history.listenBeforeUnload(function() { return 'Are you sure you want to leave this page?' }) } { let history = useQueries(createBrowserHistory)() history.listen(function(location) { console.log(location.query) }) } { let history = useQueries(createBrowserHistory)({ parseQueryString: function(queryString) { // TODO: return a parsed version of queryString return {}; }, stringifyQuery: function(query) { // TODO: return a query string created from query return "";