Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
why following Ant-Design Syntax not rendering anything?

I tried this way but no data is showing up and while compiling ,I'm not getting any error.I'm New to React , thanks in Advance

const Students = (props) => {
  let id = props.students;
  const [studentsData, setStudentsData] = useState(null);
  const url = "http://localhost:2021/students-data/" + id;
  console.log(url);

  useEffect(() => {
    axios.get(url).then((res) => {
      setStudentsData(res.data);
    });
  }, [url]);

  if (!studentsData) {
    return <Spin />;
  }

  //   console.log(studentsData)

  return (
    <List
      dataSource={studentsData}
      renderItem={(item) => {
        <List.Item key={item._id}>
          <Collapse style={{ minWidth: "257px" }}>
            <Panel header={item.name}>
              <Row gutter={[16, { xs: 8, sm: 16, md: 24, lg: 32 }]}>
                <Col className="gutter-row index" span={8}>
                  <div>Year Of Batch</div>
                </Col>
                <Col className="gutter-row value" span={16}>
                  <div>{item.yearOfBatch}</div>
                </Col>
              </Row>
              <Row gutter={[16, { xs: 8, sm: 16, md: 24, lg: 32 }]}>
                <Col className="gutter-row index" span={8}>
                  <div>Skills</div>
                </Col>
                <Col className="gutter-row value" span={16}>
                  <div>
                    {item.skills.map((e) => {
                      return e + " , ";
                    })}
                  </div>
                </Col>
              </Row>
            </Panel>
          </Collapse>
        </List.Item>;
      }}
    />
  );
};

export default Students;

why data is not rendering when I assigned collapse to renderItem attribute ? what is the main issue here ? and how to modify current code to work properly

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You missed the return keyword inside the renderItem props

It should be like this

//...
renderItem={(item) => {
        return (<List.Item key={item._id}>
          <Collapse style={{ minWidth: "257px" }}>
//...

In this case it works as expected

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda