#
January 12, 2018 at 8:55 am
Hey,
There is something i dont understand about flex.
Im using react on an electron project, i am using a libary called react-list. which render a list..
If i want a scroll, i need to wrap react-list with a div with overflow:auto. however i also need to give height to the div, unless he just goes to the end and the scroll has no effect.
I work with flexbox, so i dont want to give fixed height in PX, so i wrap the who thing in a flex container and gave the div wrapper a flex property of 1 –
In that case the list just grew crazy and the scroll didnt have any effect, but when i added flex-basis: 1px; it suddenly became perfect (the list height was limited to the screen height and the scroll worked fine)
So I wanted to undertand why it works like that, why the flex:1; don’t do the job? and why i need to add the flex-basis?