我对 React 还很陌生,现在正在尝试使用 Storybook。我在使用时遇到以下错误npm run storybook。我已经尝试弄清楚,但我仍然不确定。
无法读取未定义的属性(读取“类型”) TypeError:无法读取未定义的属性(读取“类型”)
at isMdx (http://localhost:6006/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_lib_runtime_RefreshUtils_js-node_mod-3a4695.iframe.bundle.js:3504:30)
at mdxToJsx (http://localhost:6006/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_lib_runtime_RefreshUtils_js-node_mod-3a4695.iframe.bundle.js:3508:8)
at jsxDecorator (http://localhost:6006/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_lib_runtime_RefreshUtils_js-node_mod-3a4695.iframe.bundle.js:3545:19)
at http://localhost:6006/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_lib_runtime_RefreshUtils_js-node_mod-3a4695.iframe.bundle.js:9896:21
at http://localhost:6006/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_lib_runtime_RefreshUtils_js-node_mod-3a4695.iframe.bundle.js:19890:12
at http://localhost:6006/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_lib_runtime_RefreshUtils_js-node_mod-3a4695.iframe.bundle.js:19939:14
at wrapper (http://localhost:6006/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_lib_runtime_RefreshUtils_js-node_mod-3a4695.iframe.bundle.js:7412:12)
at http://localhost:6006/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_lib_runtime_RefreshUtils_js-node_mod-3a4695.iframe.bundle.js:10411:14
at http://localhost:6006/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_lib_runtime_RefreshUtils_js-node_mod-3a4695.iframe.bundle.js:10425:26
at http://localhost:6006/vendors-node_modules_pmmmwh_react-refresh-webpack-plugin_lib_runtime_RefreshUtils_js-node_mod-3a4695.iframe.bundle.js:9896:21
Run Code Online (Sandbox Code Playgroud)
似乎有问题vendors-node_modules,但有人知道如何解决这个问题吗?
我习惯于将 Express 与模板引擎一起使用,例如 Handlebars。我想开始使用 Svelte 和 SvelteKit,但我不确定如何开始使用两者。我坚持将数据从服务器传递到前端。在 Express 中,我通常会连接到数据库,然后将数据传递到res.render,然后由模板引擎接管。到目前为止,我认为我必须运行一个handle函数来传递数据,然后我可以从我的页面访问它。但似乎句柄函数针对每个请求运行,如果我的所有页面都需要不同的数据,这是否意味着我必须为每个页面使用巨大的 switch 语句或其他语句?
谁能告诉我这是否是传递数据的正确方法,或者是否有更好的方法。抱歉,我对 Metaf Rameworks 和 Svelte 还很陌生。