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

262
Vistas
Why do these function arguments have colon characters?

Can someone please explain these parameters to this function in react to me.

enter image description here

I have never seen functions parameters with a :. What exactly is it? ConditionalFormattingConfig is a defined type.

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

0

You are looking at TypeScript. There is 1 parameter, which is an Object. That's the 1st {}. Then there is a colon and another object... but that stuff after the colon is not another key:value object it is the definition of the 1st object. It's saying the 1st object must have a "config" key and the value of the config key is a "ConditionalFormattingConfig" whatever that is. And it must have an "onChange" key that takes a function that accepts a 'config' parameter (of type ConditionalFormattingConfig) and returns nothing (void). Etc....

And back to the 1st parameter, instead of using a variable name for the parameter this function takes, it is using something called "object destructuring". So instead of asking for a variable called params and then accessing it as "params.config", they are pulling the keys out of the object into variables.

// You can do this
function doSomething(params) {
  doSomethingWith(params.config)
}

// This is the same with object destructuring
function doSomething({config}) {
  doSomethingWith(config)
}

const myObject = {config: 'fast'}
doSomething(myObject)

Hope that clears things up.

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