My component 'ReportWrapper' is something like below where it import 'getReportData' which in turn return data async.
import { getReportData } from "../dataFecther";
export const ReportWrapper = ({ query }) => {
const { data, loading, error } = getReportData({ type: "1", query });
return (
<ReportTable
reportData={data}
error={error}
/>
);
The way it fetch data may not be suitable for writing Storybook stories. Is there a way to override this import of 'getReportData' to something like a mock import in stories.
Sample story
export default {
title: "Storybook",
component: ReportWrapper,
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
};
const Template = ({ args }) => {
return (
<ReportWrapper {...args} />
);
};
export const First = Template.bind({});
First.args = {
storyName: "First One",
};