fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
stuartrexking 2021-03-16T01:23:49.000800Z

Is there a simple dynamic router example where a link in a menu is “active” based on the current route?

stuartrexking 2021-03-16T01:24:13.001300Z

In my menu item component, how can I tell if the item is active based on some external router?

stuartrexking 2021-03-16T01:39:36.001700Z

Do I query for the state machine and compare that to the target in the store?

stuartrexking 2021-03-16T02:48:58.004Z

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!

jb recluse 2021-03-16T18:09:36.007300Z

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

stuartrexking 2021-03-17T03:43:50.011100Z

@chetlind_clojure Thanks. This is much simpler.

Marcus 2021-03-16T06:49:55.004800Z

@tony.kay Ok. Makes sense. 🙂 Thanks!

Marcus 2021-03-16T11:42:38.005400Z

Which function can I use to get the current state of the db?

Marcus 2021-03-17T13:52:52.013100Z

@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?

tony.kay 2021-03-17T15:44:55.013300Z

Grokking Fulcro on YouTube…it’s a lot more detailed. Not really for beginner beginners, but ok for ppl that have experience elsewhere

Marcus 2021-03-18T11:05:56.037800Z

@tony.kay thanks. I will look into that as well 🙂

Björn Ebbinghaus 2021-03-16T11:51:31.005500Z

com.fulcrologic.fulcro.application/current-state

Marcus 2021-03-16T12:11:33.005700Z

Thanks @mroerni. What about the normalized database. Is there a function to get that as well?

Björn Ebbinghaus 2021-03-16T12:12:36.005900Z

It is normalized.

Marcus 2021-03-16T12:13:34.006100Z

ok. thanks 🙂 trying to learn this stuff

tony.kay 2021-03-16T14:58:25.006600Z

consider watching the video series (there are two series now), and reading at least the first few chapters of the book.