Comments (8)
I was going to open this very issue :)
I'm interested into using hx to replace rum, in an isomorphic setup Browser/JVM. I'm talking about a real-world website that makes millions of views per day. The problem with rum is that it deviates too much from React.js, especially since the introduction of hooks.
If you want help with that:
- I can provide, time permitting, tests, code reviews and maybe patches!
- Look at what rum does in its test suite: it renders rum code to string, then compiles the same code with node.js and compares the output (basically just a
=
). I think it's a viable strategy. - I haven't check all hooks, but
useState
in CLJ could just return the initial value and use it to render to initial HTML string. Will be happy to investigate with you the problem space.
My advice, if you permit: keep the layer that hx brings on top of React.js as thin as possible, don't create unnecessary abstractions, or even don't create abstractions at all, and hx would be a killer library that stays as close to React.js as possible, especially since the design of React.js is still a giant real-world WIP. Too dangerous to introduce abstractions that could deviate any time React introduce novelty.
Thanks for reading me!
from hx.
The problem I see is that you wouldn't be able to use any 3rd party Hooks or components which are included from JS-land. I'm also not at all interested in implementing streaming rendering in CLJ, which Node.js SSR will eventually support with React Suspense.
This means that you have to separate your code base between which components and hooks are OK to use on the server vs. client-side only. Perhaps this is OK, since you could use reader-conditionals to ensure this happens. It just might be surprising.
Overall it might be a lot of work and enforce certain restrictions on the user's code that I'm not sure is worthwhile. I am listening though and will continue to consider spending some time on it in the coming weeks.
from hx.
@DjebbZ well said. Even as I am pursuing the pure cljs way, This has value.
But the question is if it should be part of the core library?
from hx.
from hx.
from hx.
Sorry for the delay.
For me it is mostly project focus, and I am not at all opposed to this idea, nor I have any say in this. Actually sorry for the noise.
from hx.
Sure, it's all up to @Lokeh. Maybe he'll consider this feature useless for his use case, or too complex, or too whatever.
from hx.
What I've done to move the needle on this is completely decouple the hiccup parser from React. The API now is like this:
(def hiccup-config
{:create-element create-element-impl
:is-element? is-element-impl
:is-element-type? is-elemene-type-impl
:fragment fragment-impl})
(hx.hiccup/parse hiccup-config [:div "Hello, hiccup!"])
This will use the functions provided in the hiccup-config
map to transform the tree.
In hx.react
, these map to react/createElement
, react/isValidElement
, etc.
I have pushed a proof of concept HTML string renderer in a separate branch: https://github.com/Lokeh/hx/blob/html/src/hx/html.clj
This would allow someone (either this library, or even an external library) to leverage hx.hiccup
for hiccup parsing and implement their own "engine" to generate HTML strings, cljfx maps, or whatever you want while sharing the same hiccup syntax as the hx
library.
from hx.
Related Issues (20)
- Destructuring defnc :keys [class] has weird behaviour HOT 1
- Improved react dev-tools support for hooks HOT 3
- CLJS data structures are compared by ref in <-effect deps HOT 11
- Semantics and API of <-state HOT 16
- class & className issue when wrapping defnc component with pure react component HOT 3
- Make it fast
- Experience Report HOT 7
- Reducers dont support Multimethods HOT 4
- Document hiccup parser API
- hx/f exceptions handlint HOT 4
- any HOT 1
- Export hooks under Clojure-style names HOT 2
- `defcomponent` API is very confusing HOT 1
- How-to contains misleading memo use HOT 7
- Push missing tags + maybe a 0.5.4 release HOT 2
- Docstring support for defnc (and defcomponent) HOT 1
- track dependencies to selectively rerender with useMemo HOT 3
- Passing down original js props in render props does not work with js->clj
- hx.hooks/useMemo deps as CLJS collection? HOT 1
- Typo in package 0.5.3 (maybe broken) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hx.