A
A
Alexander2021-09-26 22:23:59
React
Alexander, 2021-09-26 22:23:59

How to calculate block height before rendering in react?

Hello, I need to get the height of the accordion before rendering itself, I use the styled-components library and react-transition-group. The problem is in the initial animation, because it needs a block height.
I would be grateful for the help
Link

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
antares4045, 2021-09-27
@antares4045

Well, jquery somehow copes with bootstrap (they hardcode the height of the content, having never rendered it yet), but there is some kind of black magic.
I can suggest to the author to overflow: hidden the container in which the content is nested: in this case, the content will be rendered, but it will not be visible. Plus, attach a handler to
resizing the window: open the accordion at some one window width, then make it narrower and your code does like this : vlom clone and build also threw the build on pages6151807f5540e931269470.png
Although some delay, after which the increase in the height of the content begins when the page narrows, confuses me. but to me, to be honest, it's hard to look for a reason.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question