3
respostas

Erro ao criar o filtro

Compiled with problems:X

ERROR in src/pages/Filtros/index.tsx:16:13

TS2322: Type 'void[]' is not assignable to type 'ReactNode'. Type 'void[]' is not assignable to type 'ReactFragment'. The types returned by 'Symbol.iterator.next(...)' are incompatible between these types. Type 'IteratorResult<void, any>' is not assignable to type 'IteratorResult<ReactNode, any>'. Type 'IteratorYieldResult' is not assignable to type 'IteratorResult<ReactNode, any>'. Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. Type 'void' is not assignable to type 'ReactNode'. 14 | return ( 15 |

16 | {filtros.map((opcao) => { | ^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | <button | ^^^^^^^^^^^^^^^^^^^^^^^ 18 | key={opcao.id} | ^^^^^^^^^^^^^^^^^^^^^^^ 19 | onClick={()=> {selecionarFiltro(opcao)}} | ^^^^^^^^^^^^^^^^^^^^^^^ 20 | > | ^^^^^^^^^^^^^^^^^^^^^^^ 21 | {opcao.label} | ^^^^^^^^^^^^^^^^^^^^^^^ 22 | | ^^^^^^^^^^^^^^^^^^^^^^^ 23 | })} | ^^^^^^^^^^^^^^^^ 24 |

25 | ) 26 | }
obtive este erro ao criar o filltro , alguém consegue me ajudar?

/// Codifo do filtro 

export default function Filtros() {

function selecionarFiltro(opcao: IOpcao){

}
return (
    <div>
        {filtros.map((opcao) => {
            <button
                key={opcao.id}
                onClick={()=> {selecionarFiltro(opcao)}}
            >
                {opcao.label}
            </button>
        })}
    </div>
)

}

3 respostas

O que é (opcao: Iopcao)? {opcao.label} ?

interface IOpcao { id: number; label:string; }

e a interface da qual está vindo as informações

estou importando no filtros.json tbm ao inicio do codigo