ijk icon indicating copy to clipboard operation
ijk copied to clipboard

Using with @hyperapp/router

Open slacktracer opened this issue 7 years ago • 3 comments

I was unable so far to find a way to use ijk with @hyperapp/router (entirely). Have you ever?

I thought was almost there but I got stuck on (below):

const view = () =>
  h(
    "div",
    null,
    h(
      "ul",
      null,
      h("li", null, h(Link, { to: "/" }, "Home")),
      h("li", null, h(Link, { to: "/about" }, "About"))
    ),
    h("hr"),
    h(Route, { path: "/", render: home }),
    h(Route, { path: "/about", render: about })
  );

I did not find a way to turn this h(Link, { to: "/" }, "Home") to "ijk"...

And this Link({ to: "/" }) does not seem to work at all...

I'm looking into this for a few days now but I got no more clues at the moment. Are they even compatible? Or, of course they are, and am I just being silly? ¯\(ツ)

slacktracer avatar Jul 09 '18 23:07 slacktracer

Humm.. I have never tried. But ijk will only accept nodes that are of an Array type. Which means that Link(...) is probably not going to work just like that. It is an interesting problem though. I will take a look when I get some time.

In the mean time.. you could try rewrite the link function in [x, y, z] form; then you can use it!

lukejacksonn avatar Jul 10 '18 09:07 lukejacksonn

I see. I will also look into it as soon as possible. It seems h call the function if the its first argument is a function... Perhaps if ijk did the same... Or it could interop with h... I really don't know though.

I love ijk style. I love to call it once for the main view and it just works for everything else. I want to keep it that way if I can. =)

slacktracer avatar Jul 10 '18 20:07 slacktracer

Yeh, I think it is possible.. I just hadn't covered that case. I'd say a check to see if the nodeName is of type function would suffice. Glad you are liking it :)

lukejacksonn avatar Jul 11 '18 10:07 lukejacksonn