小编Seh*_*eed的帖子

StoryBook React 钩子

因此,我在代码中使用了 useLocation 挂钩,而且我是故事书的新手,我无法找到在代码中初始化该挂钩的方法:

let location = useLocation();

const parsedLocation = new URLSearchParams(location.search)
const query = parsedLocation.get('query')
const {articles, status} = useSearch(query, 50)
Run Code Online (Sandbox Code Playgroud)

故事书中

const Template = (args) => <Page {...args} />;

export const Primary = Template.bind({});
 Primary.args = {
   location: useLocation()
};
Run Code Online (Sandbox Code Playgroud)

// 它向我显示错误,无法读取未定义的属性“位置”

css reactjs react-native storybook

5
推荐指数
1
解决办法
5556
查看次数

标签 统计

css ×1

react-native ×1

reactjs ×1

storybook ×1