Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to map transition in mui?

I want to map my products in mui and put each one in Grow, but with this error Warning: Failed prop type: Invalid prop children of type array supplied to ForwardRef(Grow), expect a single ReactElement . I will be
what should i do

if (enter) {
    return (
      <Box
        sx={{
          display: "grid",
          gridTemplateColumns: "repeat(auto-fit, 250px)",
          gap: "10px",
          alignItems: "center",
          justifyContent: "space-evenly",
          padding: "0 50px",
          height: "100%",
        }}
      >
        {searchState.length ? (
          <>
            <Grow in={true}>
              {searchState.map((item) => (
                <Product key={item.id} productData={item} />
              ))}
            </Grow>
            <Grow
              in={true}
              style={{ transformOrigin: "0 0 0" }}
              {...(true ? { timeout: 1000 } : {})}
            >
              {searchState.map((item) => (
                <Product key={item.id} productData={item} />
              ))}
            </Grow>
          </>
        ) : (
          <Box sx={{stylesNone}>No products found</Box>
        )}
      </Box>
    );
  }

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can wrap your mapped components with a div or fragment (<></>)

<Grow in={true}>
   <>
       {searchState.map((item) => (
         <Product key={item.id} productData={item} />
       ))}
   </>
</Grow>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading