React unit test: access methods and state props inside functional components with Jest Enzyme

I am trying to learn writing unit tests using jest, enzyme for functional based React components. I am trying to write unit tests for the methods defined inside functional components. Please can anyone help me with this?

Mycomponent:

const MyTable = ({allRows}) => {
    const [page, setPage] = useState(0);
    const [val, setVal] = useState(0);

    const handleClick = (index) => {
            setPage(index); 
            //other logic
    };

    const handleFilter = (event) => {
        setVal(0);
        //other logic
    }

    return (
        <div className={classes.root}>
            <Paper className={classes.paper}>
                <TableContainer>
                    <Table>
                        <TableBody>
                            
                                        <TableRow 
                                        onClick={(event) => handleClick(event, row, index)}
                                        >
                                            <TableCell> </TableCell>
                                        </TableRow>  
                        </TableBody>
                    </Table>
                </TableContainer>
            </Paper>
        </div>
    );
}

export default MyTable;

setUpTest.js

// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
import {configure} from 'enzyme';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';

configure({adapter: new Adapter()});

MyTable.test.js

describe('<MyTable />', () => {
    let wrapper;
    let mockData = [{ id: 'id1' }, { id: 'id2' }]

    beforeAll(() => {
        wrapper = shallow(
            <MyTable
                allRows={mockData} 
            />);
    });

    it('handleClick Test', () => {
       const spy = jest.spyOn(wrapper.instance(), "handleClick");
    });
})

ERROR: TypeError: Cannot read property 'handleClick' of null

I also tried to console.log(wrapper.instance()) but it is returning null I also tried to access state props but it says ShallowWrapper::state() can only be called on class components

Any help is appreciated