Giter Site home page Giter Site logo

Comments (7)

alexcurtis avatar alexcurtis commented on July 19, 2024

Hi. Could I please see your style object for node? There should be a object in there called activeLink and that sets the backgroundColor.

from react-treebeard.

gbmhunter avatar gbmhunter commented on July 19, 2024

Here it is:

image

I know this style variable is being loaded in correctly as other parameters do have an effect.

from react-treebeard.

alexcurtis avatar alexcurtis commented on July 19, 2024

activeLink requires the props props.node.active to be set. Could you set a breakpoint in components/header.js line 15. When you click a node please can you see if that is being set to true and re-rendered.

from react-treebeard.

gbmhunter avatar gbmhunter commented on July 19, 2024

this.props.node.active seems to be undefined.

image

This is caught after clicking on a node. It caught two passes through this part of code after clicking, and both where undefined.

from react-treebeard.

alexcurtis avatar alexcurtis commented on July 19, 2024

Are you setting node.active in the onToggle handler, like in example/app.js? Nodes do not control this within their own state, its purely data driven from the top level.

from react-treebeard.

gbmhunter avatar gbmhunter commented on July 19, 2024

Ahhh, I think you have hinted towards the issue. I am setting node.active, but I switched the data source from the example data variable to a data source within my application state variable (I'm using the Redux framework if you are familiar with that?). Hence I'm updating the wrong data set. I'm surprised the open/close toggling of nodes still works...

Anyway, I know what I have to do now, create some actions which are dispatched inside those event handlers which modify the internal state in Redux, and it should then update fine. Thanks!

from react-treebeard.

alexcurtis avatar alexcurtis commented on July 19, 2024

@gbmhunter Cool! I'm Pleased we could get to the bottom of it. I was trying to make it more react-ish by removing state within sub-components and having it purely driven by top level data. It makes it slightly more complicated for small apps, but so much better for larger ones.

from react-treebeard.

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.