-
Notifications
You must be signed in to change notification settings - Fork 414
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
Custom tags #48
Comments
+1 I could really use this! Important enough to me that I am tackling it myself but I have limited experience with CLJS and Reagent so it will take sometime. |
…nction names. i.e custom tags (reagent-project#48)
Not sure how idiomatic it is but I have a working solution in a custom-tags branch on my fork. k2052@9a6ab3b Seems to not have broken anything (all tests still pass). Will make a PR as soon as I have some tests written and work out the most idiomatic API. |
@k2052 any word on a pr? :) |
This is an even bigger deal for react native. I'll prepare a PR |
Is there any progress on this? We also need to render hiccup that was generated elsewhere and it would help a lot. |
@holmsand this seems like it would be a nice addition. |
Yeah this would be pretty rad! 👍 |
Any update on this PR? |
I don't yet understand why this is needed. First comment mentions server-side rendering, but in that case, the app would be rendered as string to HTML, which wouldn't refer the component functions? What use case there is for sending hiccup from server to client? What about ReactNative? Obviously Reagent already works there, what would this improve on that environment? I'd prefer not introducing new abstractions, especially one with global state (atom), without good reason. |
@Deraen We currently do the latter and it is super messy :/ |
This feature would be very useful for me! |
While I didn't mention this in Clojurist Together plans directly, I have some ideas on implementing this:
This configuration will probably allow providing a function to convert keywords (or other values) to React elements, which will allow users to configure custom tags. |
I think more recent #503 covers this issue also. |
When doing server side rendering, to use components you have to manually traverse the generated html and enhance the special nodes, as you cannot return a reference to a fn from the server.
Example:
(defn my-component [n]
[:span (str n)])
Returned from the server:
[:div [:my-component 3]]
From there I manually scan it and replace :my-component for the fn reference.
Something like this would solve the problem and avoid to scan:
(r/register-component! my-component :my-component)
The text was updated successfully, but these errors were encountered: