T
T
Tyu Vyacheslav2021-07-09 09:58:06
typescript
Tyu Vyacheslav, 2021-07-09 09:58:06

Problem when using ref, throws an error?

Good afternoon, please tell me, when using the keen slider, it displays the following error: Type 'RefObject' is not assignable to type 'LegacyRef'.

perhaps these are some features of Typescript, but I'm new to it, so I don't understand a bit: swears here I

tried to set the default value useRef (null) did not help

60e7f74545694482122047.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-07-09
@Aetae

Where is the code, Vasya?
Nothing can be said without code, because such an error is impossible in normal code, the types are absolutely compatible:

declare let refObject: RefObject<'some'>;
declare let legacyRef: LegacyRef<'some'>;

legacyRef = refObject; // ok

Perhaps you have some specific type waiting for it: , but then the error message should contain it. useRef<Тип>(null)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question