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

238
Vistas
For search using API I am sending the input to the backend using string interpolation in react

I am sending like "oemName": %${''}% which works fine but without % it doesnt work which is making me wonder why its happening.

const getEquipmentNameSearch = async (SearchText?: any) => {
    console.log("Args", SearchText)

    try {
        const responseData: any = await client.query({
            query: SEARCH_EQUIPMENTS_BY_NAME,
            variables: {
                "oemName": SearchText === undefined ? `%${''}%` : `%${SearchText}%`,
                // "oemName": `${''}`
            },
            fetchPolicy: 'network-only',
            context: { role: MasterMaterialRoles.read },
        });
        const filteredResult = responseData.data.equipmentMaster?.filter((item: any) => item.oemName.toLowerCase().includes(SearchText?.toLowerCase()))
        const responseDataList = SearchText ? filteredResult : responseData.data.equipmentMaster
        dispatch({
            type: GET_EQUIPMENT_MASTER,
            payload: responseDataList,
        });

    } catch (error: any) {
        console.log('err:', error)

    }
}

On directly using ${''} I am getting '' in payload but nothing is getting rendered on the page.

Payload

about 4 years ago · Juan Pablo Isaza
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