Giter Club home page Giter Club logo

Comments (10)

raitucarp avatar raitucarp commented on May 31, 2024 6

hi @xidedix, getComputedStyle cause SSR not rendering. Some function on SidebarNav is incompatible with Next.js

from coreui-react.

ilyazarudny avatar ilyazarudny commented on May 31, 2024 6

@xidedix
https://github.com/coreui/coreui-react/blob/master/src/Shared/layout/layout.js#L3

this document body breaks server side rendering

from coreui-react.

zaruda avatar zaruda commented on May 31, 2024 2

Hi @xidedix
I’ve contacted to element-closest maintainer and he had updated polyfill to work with node environment.
Your updates are also cool :)

from coreui-react.

xidedix avatar xidedix commented on May 31, 2024

duplicate #37

from coreui-react.

xidedix avatar xidedix commented on May 31, 2024

hi @zaruda
please update @coreui/react to v2.1.2 and let us know if this works for you

from coreui-react.

zaruda avatar zaruda commented on May 31, 2024

@raitucarp +1

from coreui-react.

mingderwang avatar mingderwang commented on May 31, 2024

+1

from coreui-react.

ryuken avatar ryuken commented on May 31, 2024

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 😋

from coreui-react.

VyacheslavKazadaev avatar VyacheslavKazadaev commented on May 31, 2024

@xidedix
https://github.com/coreui/coreui-react/blob/master/src/Shared/layout/layout.js#L3

this document body breaks server side rendering

Hello everyone. Has anyone been able to fix this?

from coreui-react.

woothu avatar woothu commented on May 31, 2024

The issue should be solved in v3

from coreui-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.