I'm trying to test the handleClickCancel function but react.creatref this with current as null
My Component structure:
@inject('requestRefund')
@observer
export class RefoundGrid extends React.Component<
Props & RouteComponentProps<any> & State
> {
state = DEFAULT_STATE || [];
render() {
const { message, typeMessage, loading } = this.props.requestRefund;
handleClickCancel = async () => {
this.setState({ openConfirm: false });
};
return (
<BaseLayout>
</BaseLayout>
);
}
}
My test:
it('requestRefundRef current test handleClickCancel ', () => {
const refoundGridRef = React.createRef<RefoundGrid>();
const { current } = requestRefundRef;
console.log(current); // current is null
});
What can I do?
Aucun commentaire:
Enregistrer un commentaire