Comments (8)
No, the extra components are necessary. Reagent does all its bookkeeping by wrapping native React components, so that it can avoid unnecessary re-renderings etc.
React components are extremely cheap, they're are nothing like DOM elements in terms of cost. And they're especially cheap if they only have one child.
The missing feeling of "snappiness" might be caused by my example's use of on-mouse-up
in the input field, rather than on-mouse-down
. I've pushed that change to http://holmsand.github.io/reagent/ – check it out and see if it feels better.
from reagent.
This must have done the trick, feels snappy to me now. Thanks.
from reagent.
Always nice when you can add snappiness simply by changing "up" to "down" :)
from reagent.
I don't think this explains it, because I don't even use the mouse to add TODOs. Anyway, never mind, it seems to be OK now....
from reagent.
Oh, I meant on-key-down, but my fingers didn't listen to my head... See b1bec33
from reagent.
Hmm. But, even if it has a negligible performance impact (it still has an impact on diffing right?), it does make navigating the React tree through the react-plugin on chrome a little bit annoying. I don't know if this is that big of a deal (I don't use the react-plugin that much, but when I do, it's a bit annoying to navigate a tree twice as long as the html), but it's worth keeping in mind.
from reagent.
No, it does not affect diffing (React diffs one level in the component tree at a time, and there'll be the same amount of components at each level – and the single-child wrapper components that Reagent adds obviously don't need any fancy diffing).
The overhead should instead only be noticeable on the very first rendering – but as I said, it ought to be small.
The big win of this design, is that it fits very well into React's basic model: Reagent components are just normal React components, as far as React is concerned.
At the same time, Reagent components can use immutable data structures all the way down, and only need to re-render (and thus create the actual React components) when their arguments change.
from reagent.
Ahh ok, thanks for explaining :)
from reagent.
Related Issues (20)
- Infinite loop in the reagent.impl.input wrapper HOT 1
- Reaction value propagation glitch - the dirty flag is not set HOT 3
- Bad react key warning when using false as key
- examples/material-ui not work HOT 1
- examples/material-ui not work HOT 1
- 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
- Any interest in being able to replace `react/createElement` with a custom function? HOT 7
- 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
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.