Чтобы добавить перевод, откройте Pull Request по этой ссылке.
Отображается содержимое для языка по умолчанию.
import {} from "effector-solid/scope";
Since effector 23.0.0 the core team recommends using the main module of effector-solid
instead.
Provides all exports from effector-solid, but enforces the application to use Scope for all components.
Usage
You can use this module in the same way as effector-solid, but it will require passing Scope to Provider component.
import { fork } from "effector";import { Provider } from "effector-solid/scope";import { render } from "solid-js/web";
const scope = fork();
render( <Provider value={scope}> <Application /> </Provider>, document.getElementById("root"),);
Migration
Since effector-solid/scope
is deprecated, it is recommended to migrate to effector-solid by removing scope
from the import path.
import { Provider } from "effector-solid";import { Provider } from "effector-solid/scope";
effector-solid
and effector-solid/scope
do not share any code, so you have to migrate all your code to effector-solid
at the same time, because otherwise, you will get runtime errors. These errors will occur because effector-solid
and effector-solid/scope
will use different instances of Provider
and do not have access to each other’s Provider
.
Scope enforcement
All modern hooks of effector-solid
are designed to work with Scope. If you want to imitate the behavior of the effector-solid/scope
module, you can pass a second parameter to hooks with an option forceScope: true
. In this case, the hook will throw an error if the Scope is not passed to Provider.
import { useUnit } from 'effector-solid/scope' import { useUnit } from 'effector-solid'
function MyComponent() { const { test } = useUnit({ text: $text }) const { test } = useUnit({ text: $text }, { forceScope: true })
return <p>{text}</p>}
Документация на английском языке - самая актуальная, поскольку её пишет и обновляет команда effector. Перевод документации на другие языки осуществляется сообществом по мере наличия сил и желания.
Помните, что переведенные статьи могут быть неактуальными, поэтому для получения наиболее точной и актуальной информации рекомендуем использовать оригинальную англоязычную версию документации.