Is there a simple dynamic router example where a link in a menu is “active” based on the current route?
In my menu item component, how can I tell if the item is active based on some external router?
Do I query for the state machine and compare that to the target in the store?
The approach I’m going with is to query for my router in my menu item, get the :target from :local-storage, and compare that to the ident of the component that the item routes to. If it’s a match, then it’s active, otherwise not. It feels a little icky having to look up the router in the menu item. If anyone has any better suggestions please share!
https://github.com/fulcrologic/fulcro-template/blob/master/src/main/app/ui/root.cljs#L185-L191 is this equivalent to what you're trying to do? current-route
is more involved than what you've described, but i think it ends up about the same in normal situations https://github.com/fulcrologic/fulcro/blob/2e38ab328ac4ef9f06778cf117fdc677ceec4aa5/src/main/com/fulcrologic/fulcro/routing/dynamic_routing.cljc#[…]
definitely possible i'm misunderstanding or missing a complexity
@chetlind_clojure Thanks. This is much simpler.
@tony.kay Ok. Makes sense. 🙂 Thanks!
Which function can I use to get the current state of the db?
@tony.kay Yes! I have read the four first chapters in your book now + the minimalist intro by Jakub. I've also just started on the fulcro 3 series on youtube. Which is the other one?
Grokking Fulcro on YouTube…it’s a lot more detailed. Not really for beginner beginners, but ok for ppl that have experience elsewhere
@tony.kay thanks. I will look into that as well 🙂
com.fulcrologic.fulcro.application/current-state
Thanks @mroerni. What about the normalized database. Is there a function to get that as well?
It is normalized.
ok. thanks 🙂 trying to learn this stuff
consider watching the video series (there are two series now), and reading at least the first few chapters of the book.