Comments (9)
It's literally just an empty create-react-app shell with this added to App.js
:
// Added to the header:
import { FixedSizeList as List } from 'react-window';
// Added as a new child to the <App> component:
<List
height={150}
itemCount={1000}
itemSize={35}
width={300}
>
{({ index, style }) => (
<div style={style}>
Row {index}
</div>
)}
</List>
from react-window.
The 0.1.1 release you reference was nothing. 92b is too small to be anything interesting. It was just a placeholder release from the person who used to hold this package name. You can see this for yourself:
https://unpkg.com/[email protected]/lib/
This lib has nothing to do with react-tiny-virtualized-list. So the size comparison isn't that meaningful.
This lib is structured to be smaller if you only use some of its components, so looking at the full size via bundle phobia isn't all that meaningful a stat.
Anyway, this is an alpha still too, so this is probably all a bit premature. :)
from react-window.
I also want to point out that the NPM package for react-window hasn't been minified or envified yet. This is intentional, because it has special DEV mode validation and warnings.
Like React itself, you'll want to minify+envify your app anyway, which will make react-window much smaller.
So don't read too much into bundle phobia size stats
from react-window.
@bvaughn yea that makes sense, I was just curious ๐. I was under the impression that bundlephobia set the env to production, and it does show the size when minified.
from react-window.
Sorry for the quick replies last night. I was on my mobile phone.
That's fair! Bundle Phobia is doing some minification to get to that number because the raw CJS bundle in NPM is 62.51 kB, and Bundle Phobia says that [email protected] is 5.3kB "minified + gzipped".
But that number still seems a bit vague to me, because react-window has multiple components. So how is Bundle Phobia specifying which exports to use?
To test this myself, I made a new create-react-app
build:
File sizes after gzip:
36.94 KB build/static/js/main.a0b7d8d3.js
299 B build/static/css/main.c17080f1.css
Then I installed react-window@alpha and plugged in FixedSizeList
:
File sizes after gzip:
41.52 KB (+4.58 KB) build/static/js/main.2b4eba24.js
299 B build/static/css/main.c17080f1.css
So it looks like the added cost 4.58 KB (including the code I added to App.js
to actually use the list). But looking at the built bundle, I see it contains more than just the FixedSizeList
componentโ it also contains VariableSizeList
and both FixedSizeGrid
and VariableSizeGrid
โ so this is still kind of a worst case scenario. Tree shaking isn't working correctly for the build.
By manually mucking around a bit to strip out the un-used list and grid implementations, we can shave another 2.25 KB off of the minified + gzipped size, bringing the new added size to 2.33 KB.
File sizes after gzip:
39.27 KB (-2.25 KB) build/static/js/main.4e15cf18.js
299 B build/static/css/main.c17080f1.css
I'm not sure how much of the tree-shaking issue will be improved by the upcoming react-scripts@next release (which updates to Webpack 4) and how much will require changes to the react-window bundle. If this is something you're knowledgable about, I'd love to have your help!
from react-window.
@bvaughn I'd be glad to help :)
from react-window.
Fantastic!
from react-window.
Do you think you can publish your CRA test project to github that you mentioned above? I Want to use it to test a branch i'll work off of.
from react-window.
By the way! I just re-test this with the latest react-window release (1.0.2) and size increase after adding FixedSizeList
is +2.26 KB thanks to a few build optimizations.
from react-window.
Related Issues (20)
- Can I replace the blank spaces which is caused by scrolling fast with other components?
- Remove nodes in pairs to avoid zebra stripe flashing HOT 1
- Need access to current scroll offset to avoid two lists scrolling each other exceed maximum rerender depth. HOT 1
- Scroll synchronization of List and Grid lagging HOT 2
- Why is the onscroll method triggered when the page is first rendered HOT 1
- Styling are not added properly in Table body
- Add "behavior" option for scroll methods
- VariableSizeGrid has issue when row count over 1000
- Section Header
- Deteriorated performance on lists exceeding 1000 elements
- Can't use react-window in vite react-ts HOT 1
- innerElementType doesn't work
- Input is losing focus , when wrapped with VariableSizeList HOT 2
- when i use "WindowScroller", why the page is constantly refreshing?
- Shifting all items in a list
- Loading indicator while it loads all 1m rows HOT 1
- onClick inside <List /> element doesn't work HOT 1
- Blanks appear on fast scrolling in react 18 use createRoot HOT 2
- add new item error when use VariableSizeList
- Allow canceling scroll
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 react-window.