Skip to content

Commit

Permalink
Add object ref test
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova committed Mar 23, 2022
1 parent c62b235 commit 67e0f08
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/mui-material/test/typescript/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import DialogTitle from '@mui/material/DialogTitle';
import DialogContent from '@mui/material/DialogContent';
import DialogContentText from '@mui/material/DialogContentText';

export default function TestStandardPropsUsage() {
function TestStandardPropsCallbackRefUsage() {
const contentRef = React.useRef<HTMLDivElement | null>(null);

const setContentRef = React.useCallback((node: HTMLDivElement | null) => {
Expand All @@ -21,3 +21,16 @@ export default function TestStandardPropsUsage() {
</Dialog>
);
}

function TestStandardPropsObjectRefUsage() {
const contentRef = React.useRef<HTMLDivElement | null>(null);

return (
<Dialog open>
<DialogTitle>Dialog Demo</DialogTitle>
<DialogContent ref={contentRef}>
<DialogContentText>Dialog content</DialogContentText>
</DialogContent>
</Dialog>
);
}

0 comments on commit 67e0f08

Please sign in to comment.