DEV Community

Discussion on: How to adjust the size of the container based on the contents without repeating same lines of code?

Collapse
 
dance2die profile image
Sung M. Kim

Seems it's already answered :)

You just need to define a boolean variable to have a flag if there are attachments or not and then use it to set the extra prop and to render or not the DetailsAttachments component like this:

renderData = () => {
  const attachments = [a, b, c, d, e];