G
G
groulls2020-09-20 13:32:55
typescript
groulls, 2020-09-20 13:32:55

Throw props using TS?

There are 2 functional components, Parent and Child. I throw props in this way.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2020-09-20
@groulls

export const Auth: React.FC = () => {
    const onChange1 = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {}, []);
    const onChange2 = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {}, []);
    return(
            <Child  Parent = {{onChange1, onChange2}}/>
    )
}

PS I missed curly brackets here:
export const Child: React.FC<Props> = ({onChange1, onChange2}) => {

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question