Skip to content

Below code is perfectly working in Codesandbox but not working in Stackbliz #3215

@rsranjeet

Description

@rsranjeet

Below code is perfectly working in Codesandbox but not working in Stackbliz

Error:
Error in /turbo_modules/[email protected]/cjs/react.development.js (1205:31)
Cannot read properties of null (reading 'useContext')

import React, { useState } from 'react';
import { Backdrop, Box, Button, Typography } from '@mui/material';

const OverlayExample = () => {
const [open, setOpen] = useState(false);

const handleToggle = () => {
setOpen(!open);
};

return (



{open ? 'Close Overlay' : 'Open Overlay'}

<Backdrop open={open} style={{ zIndex: 1 }}>
<Box
sx={{
width: 300,
height: 200,
bgcolor: 'background.paper',
boxShadow: 3,
p: 4,
borderRadius: 2,
}}
>

This is an overlay


You can place any content here.




);
};

export default OverlayExample;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions