@yandex/ymaps3-types
Version:
Types for ymaps3 maps library
45 lines (44 loc) • 1.45 kB
TypeScript
/**
* Key is used in `reactify` wrapper, to define custom implementations for react ymaps3.YMapEntity entities
* ```typescript
* type YMapSomeClassProps = {
* id: string;
* };
* export class YMapSomeClass extends ymaps3.YMapComplexEntity<YMapSomeClassProps> {
* static [ymaps3.overrideKeyReactify] = YMapSomeClassReactifyOverride;
* //...
* }
* ```
* and
* ```jsx
* export const YMapSomeClassReactifyOverride = (
* YMapSomeClassI, // it is same YMapSomeClass
* {reactify, React}
* ) => {
* const YMapSomeClassReactified = reactify.entity(YMapSomeClassI); // Standard reactivation method
* const YMapSomeClassR = React.forwardRef((props, ref) => {
* return (<>
* <YMapSomeClassReactified {...props} ref={ref} ... />
* </>);
* })
* return YMapSomeClassR;
* }
* ```
* and in the end app
* ```jsx
* import {YMapSomeClass} from './some-class';
* import React from 'react';
* import ReactDOM from 'react-dom';
* // ...
* const ymaps3React = await ymaps3.import('@yandex/ymaps3-reactify');
* const reactify = ymaps3React.reactify.bindTo(React, ReactDOM);
* const {YMapSomeClass as YMapSomeClassR} = reactify.module({YMapSomeClass});
*
* function App() {
* return <YMapSomeClassR id="some_id"/>;
* }
* ```
*/
export declare const overrideKeyReactify: unique symbol;
export declare const overrideKeyVuefy: unique symbol;
export declare const optionsKeyVuefy: unique symbol;