Graphin doesn't work with global state library Jotai
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
Using global state library such as Jotai or Zustend causes the following error:
> *TypeError: Cannot read properties of undefined (reading 'manipulateBehaviors')*
However, using `useState` works as expected.
```javascript
const [layout] = useAtom(layoutAtom);
// versus
const [layout] = useState("graphin-force");
```
Full code below:
```javascript
import Graphin, { Utils, Behaviors } from "@antv/graphin";
import { atom, useAtom } from "jotai";
import "./styles.css";
const { ZoomCanvas } = Behaviors;
const data = Utils.mock(10).circle().graphin();
const layoutAtom = atom("graphin-force");
export default function App() {
const [layout] = useAtom(layoutAtom);
// const [layout] = useState("graphin-force");
return (
);
}
```
### Your Example Website or App
https://codesandbox.io/s/graphin-jotai-g2n4je?file=/src/App.tsx
### Expected behavior
Graphin should work with Jotai
Contributor guide
Assessment
This issue has not been assessed yet.