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

parameterize props #7

Open
hth2 opened this issue Feb 13, 2014 · 1 comment
Open

parameterize props #7

hth2 opened this issue Feb 13, 2014 · 1 comment

Comments

@hth2
Copy link

hth2 commented Feb 13, 2014

I have this code:

hiccup
  [div
    [ComponentA {prop1: "abc", prop2: def"} 123]
    [ComponentB {prop1: "abc", prop2: def"} 456]
  ]

is it possible to have {prop1: "abc", prop2: def"} as a variable?

@lantiga
Copy link
Owner

lantiga commented Feb 13, 2014

I had thought about this when I first wrote the library, then I concluded not to support this - the same way it is not supported in JSX. The reason is that knowing if there are properties or not would only be known at runtime.
In the end macroexpanded code would be significantly more convoluted and there would be additional runtime costs (which may or may not have an impact, we'd have to measure).

Having said this, I haven't made up my mind. I'm going to keep the issue open and think about it.

Currently the way around it is to define a component that directly embeds the properties.

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