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

178
Vistas
Type '{ label: string; }' is not assignable to type 'IntrinsicAttributes & { children?: ReactNode; }'

I am using the Fluent UI, imported the Toggle component and got a UI Toggle exported:

export const UIToggle: React.FunctionComponent = () => {
  return (
    <Stack tokens={stackTokens}>
      <Toggle label="Enabled and checked" defaultChecked onText="On" offText="Off" />
    </Stack>
  );
};

but when I want to use it and update the 'label' attribute:

<UIToggle label = "Turn on"></UIToggle>

here is the error:

Type '{ label: string; }' is not assignable to type 'IntrinsicAttributes & { children?: ReactNode; }'.
  Property 'label' does not exist on type 'IntrinsicAttributes & { children?: ReactNode; }'

Can anyone explain why this error appears and how can I solve it?

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

0

I need to provide label as an argument to the interface. With the following revision, it is working well now

import * as React from 'react';
import { Stack, IStackTokens } from '@fluentui/react/lib/Stack';
import { Toggle } from '@fluentui/react/lib/Toggle';

const stackTokens: IStackTokens = { childrenGap: 10 };

interface ILabels {
  label: string
}
export const UIToggle: React.FunctionComponent<ILabels> = (props) => {
  return (
    <Stack tokens={stackTokens}>
      <Toggle label={props.label} defaultChecked onText="On" offText="Off" />
    </Stack>
  );
};
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