cyclic-router icon indicating copy to clipboard operation
cyclic-router copied to clipboard

Question: its possible to make a Link component?

Open cloud-walker opened this issue 9 years ago • 4 comments

I'm wondering if with cyclejs is possible to craft a generic Link component that accept the route from the props, and manage the click event handler internally.

I saw the dynamic change route section on the readme, but it seems ugly to me as you need to create a class for each link, and map them all on the router: xs.merge ... thing.

cloud-walker avatar Sep 07 '16 06:09 cloud-walker

but it seems ugly to me as you need to create a class

I've never written a class inside of a Cycle.js application, nor have I seen one :) The PascalCase is a conventionin the Cycle.js community to distinguish components from other functions.

I don't see any particular reason why a Link component couldn't be create, it just hasn't been yet.

TylorS avatar Sep 07 '16 08:09 TylorS

I mean css class like them: image

I really have to invent a class to bind every anchor of my application? Or I'm missing something? I'm pretty new here as you may have noticed :sweat_smile:

cloud-walker avatar Sep 07 '16 10:09 cloud-walker

You could just listen to anchor tags. DOM.select('a').events('click')

TylorS avatar Sep 07 '16 17:09 TylorS

To be able to toggle the "active" state of the link, I feel like a feature is missing on RouterSource for this to be possible: the possibility to know whether the current location matches a path (or the current namespace + path part). Or is there something I missed?

jerive avatar Nov 06 '16 09:11 jerive