Skip to content

Can I use multiple frameworks on one page (for instance Ember and React)? ​

Yes. One WarpDrive store can drive components from more than one framework on the same page. Import @warp-drive/alien-signals/install first, then each framework's install entry point:

ts
import '@warp-drive/alien-signals/install';
import '@warp-drive/ember/install';
import '@warp-drive/react/install';

Each framework generally only re-renders in response to its own signals implementation: Ember re-renders for its autotracking tags, and React components re-render for the signals that @warp-drive/react subscribes them to. On its own, each framework's install entry point configures WarpDrive to use that framework's signals alone.

@warp-drive/alien-signals solves this. Its install entry point configures a signals graph that the frameworks imported after it add their signals to. It also provides the memos for all of them, so memoized values update in every framework. Import it first: importing it after another framework's install entry point throws.

Derivations only track WarpDrive's signals

With @warp-drive/alien-signals/install, memoized values such as derived fields only recompute when a signal WarpDrive manages changes. If a derivation reads state that only a framework tracks, such as an Ember @tracked property or a React useState value, it keeps returning its cached value when that state changes. Keep the state a derivation reads in WarpDrive, for instance as a field on the resource it derives from.

For a complete example with Ember and React, see Using Ember and React on the Same Page.

Released under the MIT License.