-
-
Notifications
You must be signed in to change notification settings - Fork 268
Enable for server-side rendering. #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
duplicate #37 |
hi @zaruda |
Hi @xidedix |
hi @xidedix, getComputedStyle cause SSR not rendering. Some function on SidebarNav is incompatible with Next.js |
@raitucarp +1 |
+1 |
@xidedix this document body breaks server side rendering |
I extended SidebarNav like this to make it work in NextJS/SSR: import React from "react"
import { NavItem, NavLink } from "reactstrap"
import {
AppSidebarNav,
} from "@coreui/react"
class SidebarNav extends AppSidebarNav {
navLink = (item, key, classes) => {
const url = item.url ? item.url : ""
const itemIcon = <i className={classes.icon} />
const itemBadge = this.navBadge(item.badge)
const attributes = item.attributes || {}
return (
<NavItem key={key} className={classes.item}>
{attributes.disabled ?
<NavLink href={""} className={classes.link} {...attributes}>
{itemIcon}{item.name}{itemBadge}
</NavLink>
:
this.isExternal(url) ?
<NavLink href={url} className={classes.link} active {...attributes}>
{itemIcon}{item.name}{itemBadge}
</NavLink> :
<NavLink to={url} className={classes.link} onClick={this.hideMobile} {...attributes}>
{itemIcon}{item.name}{itemBadge}
</NavLink>
}
</NavItem>
)
}
}
export default SidebarNav The last NavLink is incorrect (it should be something like "Link" from "next/link" i guess It would be nice if @coreui would make a base SidebarNav and let you choose if you want to use their react-router-dom version or use something like this 😋 |
Hello everyone. Has anyone been able to fix this? |
The issue should be solved in v3 |
element-closest dependency makes your package incompatible with server side rendering
The text was updated successfully, but these errors were encountered: