Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
ReactJs: la tarjeta de pestañas de diseño Ant no muestra el contenido

Mis componentes usaron ReactJs Framework que se construyó con Ant Design UI . Mi estancamiento es la representación en el contenido de las pestañas.

Intento anidar el componente LoginForm en el componente TabsCard .

Nota : el componente LoginForm puede procesarse correctamente de forma independiente sin anidar el caso.

Componente representado en la imagen que adjunto:

ingrese la descripción de la imagen aquí

Aquí está mi código:
TabsCard.js

 import React, { useState } from 'react'; import { Card } from 'antd'; import LoginForm from '../LoginForm/index.js'; function TabsCard() { const tabList = [ { key: 'tab1', tab: 'Sign in' }, { key: 'tab2', tab: 'Sign up' } ]; const contentList = { tab1: <LoginForm />, tab2: <p>signup</p>, }; const [activeTab, setActiveTab] = useState('tab1'); const handleTabChange = key => { setActiveTab(key); }; return ( <Card style={{ width: '400' }} tabList={tabList} activeTabKey={activeTab} onTabChange={key => { handleTabChange(key); }} > {contentList[setActiveTab]} </Card> ); } export default TabsCard;

¡Gracias por tu apoyo!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Cambiar de contentList[setActiveTab] a contentList[activeTab]

Ejemplo de código completo

 import React, { useState } from 'react'; import { Card } from 'antd'; import 'antd/dist/antd.css'; function TabsCard() { const tabList = [ { key: 'tab1', tab: 'Sign in' }, { key: 'tab2', tab: 'Sign up' } ]; const contentList = { tab1: <div>Login form</div>, tab2: <p>signup</p>, }; const [activeTab, setActiveTab] = useState('tab1'); const handleTabChange = key => { setActiveTab(key); }; return ( <Card style={{ width: '400' }} tabList={tabList} activeTabKey={activeTab} onTabChange={key => { handleTabChange(key); }} > {contentList[activeTab]} </Card> ); } export default TabsCard;

espero haberte ayudado

¡Que tengas un lindo día!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!