ReactJS - Filtros

 
Vista:

Filtros

Publicado por Aplicar nuevos resultados en un componente (13 intervenciones) el 30/07/2021 10:00:59
Hola, estoy intentando aplicar filtros que están creados en un componente.
Este componente debe pasarle los filtros a otro componente, estos componentes están "juntos" pero no uno dentro de otro.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
return (
<div>
<ComponenteFiltros FuncionRecogeDatos={CogerDatos} />
 <ComponenteFinal FuncionRecogeDatos={CogerDatos} />
</div>
 )
 
export function ComponenteFinal({FuncionRecogeDatos}) {
 
const [jsonListaOrdenesTrabajo, setJsonListaOrdenesTrabajo] = React.useState([]);
 
React.useEffect(function () {
 if (FuncionRecogeDatos=== null) {
           fetch("URL", ParametrosPost(lastHeader, null))
                .then(response => response.json())
                .then((data) => {
                    if (data.success === "1") {
                        return JSON.parse(data.datos);
                    }
                    else {
                        return data.mensaje;
                    }
                }).then(setJsonListaOrdenesTrabajo);
else{
           fetch("URL", ParametrosPost(lastHeader, FuncionRecogeDatos))
                .then(response => response.json())
                .then((data) => {
                    if (data.success === "1") {
                        return JSON.parse(data.datos);
                    }
                    else {
                        return data.mensaje;
                    }
                }).then(setJsonListaOrdenesTrabajo);
}
}, []);
 
return(
<DocumentCardOrdenesTrabajos OrdenTrabajoSeleccionada={OrdenTrabajoElegida} JsonInformacion={jsonListaOrdenesTrabajo} />
);
 
}

Ahora mismo no se me ocurre como repararlo
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder