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

88
Views
Establecer valor predeterminado a través de accesorios

tengo estos dos componentes

 <Field component={renderTextField} id="jobTitle" label={t("field1")} name="jobTitle" required defaultValue={isOfferCopied ? job.jobName ? "Test"} /> export const renderTextField = (props) => { const { input, meta: { touched, invalid, error }, endAdornment, ...restProps } = props; return ( <TextField {...input} {...restProps} variant="outlined" error={touched && invalid} helperText={touched && error} InputProps={{ endAdornment }} // margin='dense' /> ); };

Estoy tratando de enviar prop defaultValue en el componente de Field , pero la salida está vacía. ¿Como puedo resolver esto?.

¡Gracias a todos por adelantado!

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puede configurar el objeto Prop completo predeterminado aquí:

export const renderTextField = (props = { input = 'somedefaultInput', endAdornment = 'eye', meta = { touched: false, invalid: false, etc }) => {

O también puede predeterminar cuando está definiendo la const

 const { input = 'someDefaultInput', meta: { touched, invalid, error } = { touched: false, invalid: false, error: null }, endAdornment = 'eye', ...restProps } = props;

También recomendaría encarecidamente ser explícito con los accesorios que está desestructurando y evitar los ...restProps

about 4 years ago · Santiago Trujillo 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!