5 ms·
OK, hold up, I’ve been hearing this line forever and I’m here to hold it to account: > the API-compatible Preact is something like 7KB Something is up here. E
by Uehreka 3y ago
OK, hold up, I’ve been hearing this line forever and I’m here to hold it to account:
> the API-compatible Preact is something like 7KB
Something is up here. Either Preact is not in fact API-compatible (in which case people should stop saying this), or the React devs are dummies who have never thought of Preact’s architecture or looked at its open source code (I rank this unlikely) or there’s somehow some other catch that no one talks about.
Which is it? Why doesn’t React just use Preact’s architecture if it’s so lightweight? What is Preact actually giving up?
- Inviz 3y agoIt's fully api compatible pre-fiber. in fact it has more apis in some regards.
- tcpipchip 3y agoHi Did have success on littlefs on stm32 ? On arduino ? Please, contact me tcpipchip@hotmail.com PS: sorry if I post here
- Inviz 3y agoI did have some success with it. I used their generic config way to hook up fro block writing/erasing and implemented those parts in the os i was writing. However one thing I was not a fan of is that its IO is synchronous, so you have to use some sort of coroutines/multitasking unless you're ok with blocking
- gedy 3y agoFrom memory, Preact doesn't use synthetic events system like React and its runtime is much smaller. It can't be used generically like React can in mobile (React Native) or similar though because of this
- afavour 3y agoThere are definitely differences here and there. One I can remember from a year or so ago is that Preact deprecated support for string refs while React still supports them (though the docs point out they intend to deprecate IIRC). Honestly to my mind the biggest thing is that bundle size just isn’t a priority for the React team. A sibling comment pointed out that React does a lot to correctly handle SVGs. Good to have, obviously, but what percentage of React users are making interactive SVGs? Probably not a whole lot. If they wanted to the React folks could break that out into a react-svg module or something and save some KB. But they don’t want to. To my mind React these days is the enterprise software of the frontend. It’s big, it’s bulky, but it does absolutely everything with a minimum of fuss. They have a one size fits all approach and they’re not willing to deviate from it.
- fathyb 3y ago> what percentage of React users are making interactive SVGs Every single app I worked on for the past 5 years did. `mui` icons are SVG for example, and it's common practice to embed SVG as components to avoid the HTTP requests overhead and allow for theming through props.
- josephg 3y agoMost people who embed svgs aren’t looking to make them interactive though. I think I’ve attached event handlers to internal elements in an svg maybe once in my entire career.
- pcthrowaway 3y agoThings like the sparkline charts on npmjs (e.g. https://www.npmjs.com/package/npm https://www.npmjs.com/package/npm ) are interactive SVGs. I think they're pretty common for data visualizations of all kinds
- afavour 3y agoThat’s not what I’m talking about though: those aren’t interactive. You could dangerouslySetInnerHTML with them (arguably you should, it’s a waste of VDOM otherwise) and they’d be just fine.
- deleted 3y ago
- orangepanda 3y agoPreact takes the King Bumi approach to API compatibility - by sometimes doing nothing. The syntax may be compatible, but the semantics are not. For example, it doesn’t support react's concurrency features; transitions are just empty wrappers.