L
L
lookingfor22021-05-17 17:36:28
React
lookingfor2, 2021-05-17 17:36:28

How to add logic by inheriting a class?

There is a react-dadata component. I want to create a class that will inherit the main class https://github.com/vitalybaev/react-dadata/blob/ma... of the library.
I need to be able to check whether it is a city or another point before returning hints, and change my state depending on this. Please tell me how it can be implemented

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2021-05-17
@lookingfor2

No need for inheritance, do aggregation. Nest the library component in your component, do all your stuff first, and then set the state for the child component.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question