(Sorry if this was discussed before; I did some searches and couldn't find anything.)
One of the cool advantages of App History is that you can use standard anchor tags for navigations, and there's no need to call the API directly. Under the hood, it's essentially like calling appHistory.navigate() when you click an anchor tag, right?
But the navigate() method takes in an additional prop; an object which has things like state, info, and replace. If I need to add that info to my navigation, do I need to revert back to event.preventDefault()-ing the anchor click event and then calling appHistory.navigate() myself?
Or can there be other ways of doing that? (Or do they already exist?)
As an example, could there be additional HTML attributes added to the anchor tag that automatically signals whether it should be a replace navigation? <a href="/url" app-history-replace="true"> as one extremely verbose example of what it could look like. A downside of this would probably be that you couldn't have complex objects for info or state (unless you stringify them), but maybe this is still better than the alternative of not having anything at all?
Anyway, hopefully my questions make sense. 🙂 Let me know if I need to clarify anything.
(Sorry if this was discussed before; I did some searches and couldn't find anything.)
One of the cool advantages of App History is that you can use standard anchor tags for navigations, and there's no need to call the API directly. Under the hood, it's essentially like calling
appHistory.navigate()
when you click an anchor tag, right?But the
navigate()
method takes in an additional prop; an object which has things likestate
,info
, andreplace
. If I need to add that info to my navigation, do I need to revert back toevent.preventDefault()
-ing the anchor click event and then callingappHistory.navigate()
myself?Or can there be other ways of doing that? (Or do they already exist?)
As an example, could there be additional HTML attributes added to the anchor tag that automatically signals whether it should be a
replace
navigation?<a href="/url" app-history-replace="true">
as one extremely verbose example of what it could look like. A downside of this would probably be that you couldn't have complex objects forinfo
orstate
(unless you stringify them), but maybe this is still better than the alternative of not having anything at all?Anyway, hopefully my questions make sense. 🙂 Let me know if I need to clarify anything.