[HELP][OFF-TOPIC] getting invalid hook call when using in NextJS

Hi,
This question is not directly related to Apollo client. I am trying to build a client sdk with custom hooks as apollo client have (useApolloClient,useQuery, etc). I am taking reference from apollo client react folder (https://github.com/apollographql/apollo-client/tree/main/src/react). But I am getting error whenever I call my custom hook. The error is like this.

Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
    React 2
    useSlatomateClient useSlatomateClient.js:5
    Login Login.tsx:9
    React 12
    unstable_runWithPriority scheduler.development.js:468
    React 5
    scheduleRefresh react_devtools_backend.js:5230
    performReactRefresh react-refresh-runtime.development.js:304
    performReactRefresh react-refresh-runtime.development.js:293
    scheduleUpdate helpers.js:124
    setTimeout handler*scheduleUpdate helpers.js:119
    <anonymous> Login.tsx:170
    NextJS 13
    tryApplyUpdates hot-dev-client.js:252
    handleSuccess hot-dev-client.js:66
    processMessage hot-dev-client.js:176
    connect hot-dev-client.js:32
    handleMessage eventsource.js:38
    handleMessage eventsource.js:36
    init eventsource.js:25
    EventSourceWrapper eventsource.js:15
    getEventSourceWrapper eventsource.js:60
    setupPing on-demand-entries-utils.js:23
    emit mitt.js:19
    emit mitt.js:18
    _callee$ router.js:743
    Babel 16
    replace router.js:492
    componentDidMount index.js:204
    React 3

My library is here. Any kind of help is highly appreciated. :pray:

Thank you.