GithubHelp home page GithubHelp logo

Comments (4)

zksailor534 avatar zksailor534 commented on May 18, 2024

I've been trying to keep the dependencies for this component to a minimum, otherwise I probably would have used react-router <Link \>. Instead, the method I recommend is making use of the onClick property to pass something like a react-router push. I've used that on a project I was working and it eliminated the effect you mentioned.

from react-adminlte-dash.

dchan14 avatar dchan14 commented on May 18, 2024

I tried this
<Sidebar.Menu header="MAIN NAVIGATION" key="3"> <Sidebar.Menu.Item icon={{ className: 'fa-calendar' }} title="Calendar" onClick={browserHistory.push('/scheduled')} /> </Sidebar.Menu>

but i get errors -- Cannot update during an existing state transition (such as within render or another component's constructor). Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern, but can be moved to componentWillMount.

from react-adminlte-dash.

dchan14 avatar dchan14 commented on May 18, 2024

again this is an awesome react-adminLTE dashboard!!

just in case any other beginners need it. i imported browserhistory and
onClick={() => browserHistory.push('/scheduled')} the key was this thing () => bc i was getting ReactJS: Warning: setState(…): Cannot update during an existing state transition ...
i am using react router 3 with vulcanjs !!!

from react-adminlte-dash.

zksailor534 avatar zksailor534 commented on May 18, 2024

Glad you could make it work for you.

You are correct, you need to provide a function to events like onClick (or onBlur, etc) instead of a function call. The function call would be activated while rendering the page, causing the error you were seeing. You can either use onClick={() => browserHistory.push('/')} or onClick={function() {browserHistory.push('/')}}.

Closing this issue as solved.

from react-adminlte-dash.

Related Issues (15)

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.