Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with @hyperapp/router #23

Open
slacktracer opened this issue Jul 9, 2018 · 3 comments
Open

Using with @hyperapp/router #23

slacktracer opened this issue Jul 9, 2018 · 3 comments

Comments

@slacktracer
Copy link

slacktracer commented Jul 9, 2018

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? ¯\(ツ)

@lukejacksonn
Copy link
Owner

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!

@slacktracer
Copy link
Author

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. =)

@lukejacksonn
Copy link
Owner

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants