Git Product home page Git Product logo

Comments (2)

acjay avatar acjay commented on May 14, 2024 1

Ok, gotcha. Yeah, I thought more about it and it seems like it's basically a variation of the render prop pattern. I didn't recognize that with the Node pulled into a external variable, rather than provided inline as a closure. Thanks for responding!

from react-arborist.

jameskerr avatar jameskerr commented on May 14, 2024

Hi @acjay, thanks for writing up this suggestion. I know what you mean. It does seem a little strange. I based that API on the react-window library, which is used by react-arborist. Brian passes in the row renderer as a single child component.

Over time, it grew on me. It mirrors the hierarchy between the parent Tree component and the children Node components.

Since React's children are just a special-case prop, I suppose you could make this argument for any component that accepts children.

Why do we write...

<Parent>
  <Child />
</Parent>

instead of...

<Parent children={<Child />} />

I admit the way we use the "children" prop in the Tree is different than above, but it's at least a bit similar.

In the end I think this is just a "chocolate" or "vanilla" type decision, so I plan to leave the API as is.

However, I thank you for your time and for prompting me to think about this more.

from react-arborist.

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.