pullstate
pullstate copied to clipboard
Error: Invalid hook call. Hooks can only be called inside of the body of a function component.
Hi,
I'm running into an issue where react says that the hook call is not valid. Here is my current code:
Component:
import React, {useState} from 'react';
import {ViewStore} from "../globalStores";
export default function RightPane(){
const vs = ViewStore.useState(s => s.type);
return(
<div className="col-span-4">
<TopBar />
</div>
)
}
Store:
import { Store } from "pullstate";
export const ViewStore = new Store({
type: "main"
});
The exact error is the following and occurs when the viewStore is referenced at const vs = ViewStore.useState(s => s.type);:
Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component.
Thank you for the help!