Image我正在使用 Nextjs ,一个基于 React 的框架,并且我正在尝试在Next.js 提供的组件中显示 logo.png 图像。
我有这个文件夹:public/img
这是我的代码:
<Image
src={'/img/logo.png'}
width='154'
height='82'
alt='logo'
layout='responsive'
priority={true}
/>
Run Code Online (Sandbox Code Playgroud)
我在控制台中收到此错误:
资源 http://localhost:3001/_next/image?url=%2Fimg%2Flogo.png&w=640&q=75 已使用链接预加载进行预加载,但在窗口加载事件后的几秒钟内未使用。请确保它具有适当的
as值并且是有意预加载的。
有什么帮助吗?
所以我使用 flowbite 和 tailwind css 来开发我的 React 应用程序。我遵循了他们的网站中提到的所有标准安装程序,以使用 React 设置 Flowbite,请在此处参考文档: https: //flowbite.com/docs/getting-started/react/
\n因此,在完成基本设置过程后,我的 tailwind 文件如下所示:
\nmodule.exports = {\n content: [\'./src/**/*.{js,jsx,ts,tsx}\', \'./node_modules/flowbite/**/*.js\'],\n theme: {\n extend: {},\n },\n plugins: [require(\'flowbite/plugin\')],\n}\n \nRun Code Online (Sandbox Code Playgroud)\n当我需要 Flowbite 插件时,我不断收到的错误是:
\n > Could not find a declaration file for module \'flowbite/plugin\'.\n > \'C:/dev/flowbite-test/node_modules/flowbite/plugin.js\' implicitly has\n > an \'any\' type. Try `npm i --save-dev @types/flowbite` if it exists\n > or add a new declaration (.d.ts) file containing `declare module\n > \'flowbite/plugin\';`\n \nRun Code Online (Sandbox Code Playgroud)\n这里还有我的 app.js …
我的 ssr 网页在启动客户端时闪烁,这意味着页面渲染服务器端渲染的 html,然后变为空白,然后开始重新加载所有内容。
我正在开发一个反应项目,我们决定将其从在客户端渲染更改为在服务器渲染。该项目包括react-router-dom,redux和react-redux,material-ui它附带react-jss, loadable/component,还通过 来处理头元素react-helmet-async,并且在 ssr 中它使用express.js这似乎是必须的。
react-router-dom我做了文档上的所有内容。BrowserRouter在客户端和StaticRouterssr 中使用并向context其传递一个对象。redux,react-redux我保存preloaded_state在窗口中的变量中,并在客户端获取它,然后将其传递给存储。还获取了一些外部数据以获取页面源上的内容。所以我在 ssr 中有一些请求和数据获取。material-ui我创建了一个new serverSideStyleSheet并收集了整个项目的所有样式。react-helmet-async我Helmet为每个页面设置了不同的标签,收集不同的标题、描述和...个人。还有一个helmetProvidercsr 和 ssr 的包装器。react-helmet但它与 .i 不兼容。renderToNodeStream我没有更改react-helmet-async,尽管我没有使用 renderToNodeStream 但renderToNodeStream希望将其迁移到有一天。express.js我按照文档所说使用它,但是在我添加之后,loadable/component …reactjs redux server-side-rendering react-ssr loadable-component
reactjs ×3
flowbite ×1
javascript ×1
next-images ×1
next.js ×1
react-ssr ×1
redux ×1
tailwind-css ×1