Comments (6)
Its probably something else in your code. Error message is clear: missing </span>
element. Neither Iconify library renders span elements.
from iconify.
That is because the client site transform to <svg>
tag. does not match <span>
tag on server.
from iconify.
Yes, that's normal behaviour for this library. However @iconify/react
generates SVG, so you can use that instead.
from iconify.
Thanks @cyberalien
But @iconify/react
what way to render only on the client? Example
<Icon icon={faceWithMonocle} ssr={false} />
Because If uses many svg icon thenPageSpeed Insights
warning DOM elements.
from iconify.
Looks like Next.js is making rendering on client impossible.
You can try this: use @iconify/iconify
, but instead of adding span
, wrap it in some other element and use dangerouslySetInnerHTML
to insert span
:
function Icon(props) {
const html = '<span class="iconify" data-icon="' + props.icon + '"></span>';
return <span dangerouslySetInnerHTML={{__html: html}} />;
}
Not sure if it will work, but it might. This way it will have 2 span elements, Next.js should only watch for one that Iconify won't modify and inner one will be changed to svg
by Iconify.
from iconify.
@cyberalien thanks, might react-no-ssr
would be help me.
from iconify.
Related Issues (20)
- ✨ Align syntax for icons HOT 2
- Penpot integration HOT 2
- bug[React]: Icon Component does not render icon on first render when using `loadIcons` to preload HOT 5
- iconExists() not working on deployed site HOT 2
- [DEP0166] DeprecationWarning HOT 10
- [BUG] Deprecation Warning on Nuxt.js build due to package.json export HOT 2
- Workerd SSR issues HOT 1
- Hey I found an Issue !! HOT 2
- iconify/vue 使用addCollection加载图标集 还会向远程服务器发起请求吗 我想就将图标集打包到项目中
- Release of icons with android library HOT 8
- @iconify/tailwindcss redundant code HOT 16
- 在uniapp中怎么使用unocss+iconify实现图标展示啊? HOT 1
- 在uniapp中显示不出来图标 HOT 1
- @iconify/tailwind can't use underline HOT 3
- Opacity on icons HOT 1
- Feat: Type definition for all icon names HOT 1
- Icon toggles visibility when scrolled in/out of viewport - observer="false" does not work? HOT 7
- `@iconify-icon/react` prop `observe` didn't work HOT 2
- finding the "real corner" of an svg HOT 2
- Prefers reduced motion with transitions HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iconify.