Comments (8)
Hello @kirill-konshin, I am sorry but what is the use-case? I am curious!
from react-flatten-children.
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.
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.
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.
I am sorry this is not a main "use-case", if someone asks again for it I will consider it.
from react-flatten-children.
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.
@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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-flatten-children.