Comments (7)
This is probably already possible with the Compiler protocol. make-element
method is quite close to the createElement
:
https://github.com/reagent-project/reagent/blob/master/src/reagent/impl/template.cljs#LL320C11-L320C11
https://github.com/reagent-project/reagent/blob/master/src/reagent/impl/template.cljs#L128-L141
https://github.com/reagent-project/reagent/blob/master/doc/ReagentCompiler.md
You might have to refer to some impl functions to reuse the code for other methods, so the API isn't perfect, but if you get it working I can consider exposing the necessary functions.
from reagent.
Checking your fork, there are few other createElement
calls besides make-element
but I'm quite sure that those don't matter, because the elements created in those cases refer to functions, not HTML elements, and they wouldn't use css.
from reagent.
Awesome, thanks for the feedback. I'll take a look at implementing it with the compiler
from reagent.
Have it working with the compiler here: cj-price@e09a8e6
I haven't tested the other places where react/createElement
is used but for general use the compiler protocol seems more than enough to implement something like this.
Would you like me to clean up the example and submit a PR?
from reagent.
I guess Emotion is interesting enough to add a example to the repository.
The root package.json probably doesn't need to be changed?
The example should use shadow-cljs so it can use npm packages. There is an example in the material-ui folder.
The simple-example
component seems unnecessary, as you can set the compiler directly on the render call. But perhaps it is for use from the intro
ns now?
from reagent.
And a link could be added the compiler protocol docs to the example folder.
from reagent.
I submitted #593
I am using shadow-cljs as requested and removed the code from the intro. Also added a link on the docs. Willing to make any requested changes :)
The
simple-example
component seems unnecessary, as you can set the compiler directly on the render call. But perhaps it is for use from theintro
ns now?
Yeah I did my testing on the intro which is why I rendered inside the simple example component.
from reagent.
Related Issues (20)
- Docs on โChanged?โ inaccurate? HOT 5
- React 18 does not live reload with Shadow-CLJS in non-trivial projects HOT 5
- Prop types
- `TypeError` when using function components with `r/create-class` with `dom.server/render-to-string`
- ReactDOM.render is no longer supported in React 18. Use createRoot instead. HOT 2
- shadow-cljs emits a warning when using with-let HOT 4
- Korean input broken on :input and :textarea HOT 1
- Update docs? HOT 1
- MUI ThemeProvider not working HOT 1
- @@ -62,6 +62,45 @@ class _Config { } } // eslint-disable-next-line valid-jsdoc /** * fetch problem title, level via solved.ac api * @see {@link https://solvedac.github.io/unofficial-documentation/#/operations/getProblemByIdArray} * @param {string[]} pids - list of problem id (up to 100) * @param { ({ problemId, titleKo, level }) => void } callback */ function fetchProblemsFromSolvedAc(pids, callback) { const query = encodeURIComponent(pids.join(',')); console.log(`https://solved.ac/api/v3/problem/lookup?problemIds=${query}`); fetch(`https://solved.ac/api/v3/problem/lookup?problemIds=${query}`) .then((res) => { console.log('fetchProblemsFromSolvedAc', res); return res; }) .then((res) => res.json()) .then(callback) .catch(() => callback(null)); }
- Readme says npm i or add deps to .edn but (in my case at least) needed both HOT 1
- The cursor disappears at the end of a controlled input on Chrome
- Reusable components following HTML semantics of Opional Attributes and Variadic Children HOT 3
- Controlled input loses cursor under ShadowRoot in React 18 HOT 3
- snake_case mentioned instead kebab-case in documentation of create-class function.
- Class name composition is harder than it needs to be
- Missing documentation: how to pass a CSS custom property? HOT 1
- Missing documentation: what's the syntax for creating a non standard HTML attribute? HOT 1
- Is there really no way to create an HTML attribute without a value? HOT 8
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 reagent.