Git Product home page Git Product logo

Comments (8)

gregberge avatar gregberge commented on June 5, 2024

Hello @kirill-konshin, I am sorry but what is the use-case? I am curious!

from react-flatten-children.

kirill-konshin avatar kirill-konshin commented on June 5, 2024

I was making a gatsby plug-in, to wrap some MDX images, so I need to create a wrapper that would grab transformed react elements and extract some of their props to process them. The problem is markup may change so easiest way is to flatten all children and just filter them.

from react-flatten-children.

gregberge avatar gregberge commented on June 5, 2024

I think it is a very specific use-case. You should just copy the code of this repository in your project. I don't think it worth it to include it here and penalize every one (package size) for this use-case.

from react-flatten-children.

kirill-konshin avatar kirill-konshin commented on June 5, 2024

penalize every one (package size) for this use-case

I've added 62 symbols.

The proposed functionality fits perfectly as you already recursively flatten the children, all I added is a flag to do this for all elements, not just fragments.

from react-flatten-children.

gregberge avatar gregberge commented on June 5, 2024

I am sorry this is not a main "use-case", if someone asks again for it I will consider it.

from react-flatten-children.

kirill-konshin avatar kirill-konshin commented on June 5, 2024

Although I do understand that it's not a main use case, someone has already asked — me.

Addition perfectly fits in library name "react-flatten-children" — it produces flat array of all children.

I don't see any problems here, and reasons not to include... maintenance burden is not high. I can add tests if needed.

from react-flatten-children.

gregberge avatar gregberge commented on June 5, 2024

@kirill-konshin your use-case is very very specific. You lose information by stripping components. The goal of this library is a "flattening", in a flattening, nothing is lost, it is just flattened. Your use-case is completely different! Anyway, I don't understand, what is the problem to just copy a small script in your code?

from react-flatten-children.

kirill-konshin avatar kirill-konshin commented on June 5, 2024

That’s exactly what I did, I copied. Anyway, I see you’re not willing to cooperate, so I’m done here.

from react-flatten-children.

Related Issues (2)

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.