1
resposta

Type '{ children: string; onClicR: () => void; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>'.

Estou com o seguinte erro:

Property 'onClicR' does not exist on type 'DetailedHTMLProps<HTMLAttributes, HTMLHeadingElement>'. Did you mean 'onClick'? 20 | return ( 21 |

22 | <h2 onClicR={() => { | ^^^^^^^ 23 | tarefas = [...tarefas, { tarefa: "Estudar estado", tempo: "05:00:00"}] 24 | }}>Estudos do dia 25 |

    Segue meu código:

    import React from 'react'; import Item from './Item'; import style from './Lista.module.scss';

    function Lista() { let tarefas = [{ tarefa: 'React', tempo: '02:00:00' }, { tarefa: 'Javascript', tempo: '01:00:00' }, { tarefa: "Typescript", tempo: "03:00:00" }]; return (

    <h2 onClicR={() => { tarefas = [...tarefas, { tarefa: "Estudar estado", tempo: "05:00:00"}] }}>Estudos do dia
    • {tarefas.map((item, index) => ( <Item key={index} {...item} /> ))}
    ) }

    export default Lista;

    1 resposta

    no h2, o certo seria onClick ao invés de onClicR

    - Antes:
    <h2 onClicR={() => { tarefas = [...tarefas, { tarefa: "Estudar estado", tempo: "05:00:00"}] }}>Estudos do dia
    
    - Depois:
    <h2 onClick={() => { tarefas = [...tarefas, { tarefa: "Estudar estado", tempo: "05:00:00"}] }}>Estudos do dia