Initial values
See original GitHub issueThank you for this very handy project! I have just made a PR to add it to Recharts (http://recharts.org), but there is a minor thing that makes them sort of incompatible.
React-container-dimensions is always sending its initial state (width and height set to zero) to the children components on the first render, and therefore Recharts prints multiple warns saying that it can’t render the charts in these conditions.
Can we send others values, other than zeros, to the children? What about having a third parameter hasInitiated
, or send null
as first values?
Link to the PR: recharts/recharts#105
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Initial value problem - Wikipedia
In multivariable calculus, an initial value problem (IVP) is an ordinary differential equation together with an initial condition which specifies the value ......
Read more >Initial Value Problem - YouTube
This calculus video tutorial explains how to solve the initial value problem as it relates to separable differential equations.
Read more >Setting initial values
Initial values are a way of speeding up the interview by displaying questions with a certain answer or set of answers preselected.
Read more >Initial value - CSS: Cascading Style Sheets - MDN Web Docs
For inherited properties, the initial value is used on the root element only, as long as no specified value is supplied. · For...
Read more >Initial Values - Micro Focus
Initial values are used to ensure that all the data items used within a fragment are in their correct initial state when fragment...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, I couldn’t understand what you mean by
since this is doable in the callback
. Could you clarify it?I think it is wrong to send
{ width: 0, height: 0 }
in the first render because it is just conceptually wrong since the container does not have these dimensions. My understanding is that we should not be sending wrong data just because we don’t have the actual data.So, to be able to get the real data (the container size), we need to render something in first place. Rendering
null
and then executingReactDOM.findDOMNode(this).parentNode
would fail. But we can’t render thechildren
because we don’t have the dimensions yet. It is a circular dependency!Therefore, we have three options:
children
.children
would be able to know that when{ width: null, height: null }
it should wait for the next render.hasInitiated
that we pass to thechildren
so it is then aware that we don’t have the actual dimensions yet and we give thechildren
the responsibility of dealing with it.I am sending now a PR for the approach 1.
thank you!