nathancahill / split

Unopinionated utilities for resizeable split views
https://split.js.org/
MIT License
6.1k stars 448 forks source link

TypeError: Object prototype may only be an Object or null: undefined #796

Closed Sagarshivalingappaathani closed 5 months ago

Sagarshivalingappaathani commented 10 months ago

import React from 'react' import Split from 'react-split'; import '../../styles/global.css';

type Props = {}

const workSpace = (props: Props) => { return (

1
2

) }

export default workSpace

when i am using Split in Typescript it is giving the error as

⨯ node_modules\react-split\dist\react-split.js (23:40) @ create ⨯ TypeError: Object prototype may only be an Object or null: undefined at Function.create () at eval (webpack-internal:///(rsc)/./node_modules/react-split/dist/react-split.js:24:41)
at eval (webpack-internal:///(rsc)/./node_modules/react-split/dist/react-split.js:175:6)
at eval (webpack-internal:///(rsc)/./node_modules/react-split/dist/react-split.js:3:30) at eval (webpack-internal:///(rsc)/./node_modules/react-split/dist/react-split.js:4:3) at (rsc)/./node_modules/react-split/dist/react-split.js (C:\Users\sagar\OneDrive\Desktop\letsCode SLP\letscode.next\server\vendor-chunks\react-split.js:20:1) at webpack_require (C:\Users\sagar\OneDrive\Desktop\letsCode SLP\letscode.next\server\webpack-runtime.js:33:42) at eval (webpack-internal:///(rsc)/./components/Workspace/Workspace.tsx:9:69) at (rsc)/./components/Workspace/Workspace.tsx (C:\Users\sagar\OneDrive\Desktop\letsCode SLP\letscode.next\server\app\problems[id]\page.js:323:1) at webpack_require (C:\Users\sagar\OneDrive\Desktop\letsCode SLP\letscode.next\server\webpack-runtime.js:33:42) { type: 'TypeError', page: '/problems/two-sum' } null

M-Sanjay12o52o commented 8 months ago

have you resolved this??

Sagarshivalingappaathani commented 8 months ago

import React from 'react'; import Split from 'react-split'; import '../../styles/global.css';

const workSpace = (props: Props) => { return ( <>

</>

);

};

export default workSpace;

this worked for me

if still not if you are using next.js add "use client"; at the top of the file

cliftonlabrum commented 8 months ago

Adding 'use client'; fixed it for me.

amineazizix commented 5 months ago

Adding use client directive fixed it for me too. Thanks @cliftonlabrum