> ## Documentation Index
> Fetch the complete documentation index at: https://bym.lonestill.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# api.React

> Доступ к React Fiber дереву Яндекс Музыки

<Warning>
  YM может использовать нестандартную сборку React. Если `getFiber` возвращает `null` — версия YM не оставляет стандартные `__reactFiber*` ключи на DOM-узлах.
</Warning>

## Методы

```js theme={null}
api.React.getFiber(element)             // → Fiber | null
api.React.getProps(element)             // → object | null
api.React.getState(element)             // → object | null
api.React.getOwner(element)             // → component instance | null
api.React.findFiber(element, predicate) // → Fiber | null
api.React.forceUpdate(element)          // перерисовать component
```

## Пример

```js theme={null}
const btn   = document.querySelector('[class*="LikeButton"]');
const props = api.React.getProps(btn);
// { onClick: f, isLiked: true, trackId: '123', ... }

// Найти fiber с нужным prop
const fiber = api.React.findFiber(btn, f => f.memoizedProps?.trackId);
```
