Comments (10)
The only downside I can think of is propTypes
don't warn when you pass in extra props. I can't think of any scenarios where this would actually affect us negatively though.
from cf-ui.
Oh this has been open for a while and nobody has any comments yet! Let me take take a stab at it :)
What's the downside of doing something like:
<input {...props} />
in our components?
I can see the benefit being for example we don't have to make a PR to cf-ui to make sure that we can disable a toggle which would speed up our process.
from cf-ui.
Sure. Let's ID a list of components we want to do this first. As it stands, a lot of the typographic components are not useful at all and I don't see the value of working on them further. There may be others that aren't useful.
from cf-ui.
Also, we might not want all props to be expanded, just those we know are accepted by HTML5.
from cf-ui.
Ok, we could keep a list maybe of allowed props? What would be the downside of expanding all props?
from cf-ui.
I have no good reason to continue with a whitelist approach so far, just something we need to keep in mind. Best go thru all the components now and see if there are idioms in them that have a high probability in resulting accidental overwrites of attributes.
from cf-ui.
This is a living ticket as PRs that allow arbitrary props to be passed into the cf-ui components are opened and merged, until all components are fixed.
from cf-ui.
@wyuenho In order for this to be actively worked on (and maybe one day finished) could you list up the places where we are not passing the props through so we have a idea of how much is left of this ticket?
Maybe it even goes hand-in-hand with the fela migration since createComponent
accepts a passThroughProps
parameter?
from cf-ui.
It actually goes against fela migration since createComponent
needs a white list of props that should pass through (passThroughProps
). Although, it's probably going to change since it's not a good approach.
I like props validation a lot because it gives us some clear contract and you can see it in docs. If there's something missing just open a PR. Eventually, we will cover everything. It's not that hard.
from cf-ui.
I'm going to close this one. There is one and only one practical reason that convinced me passing thru arbitrary props is a bad idea when combined with Fela, which is enough to challenge my initial rationale.
When implementing selector heavy styles, where some style props have to propagate from multiple levels down, the component at each level will have to know both what will be passed down implicitly, and what to pass down explicitly. If we allow arbitrary prop spreading, undeclared extra props may be passed all the way down from great grand parent to child unexpectedly. This makes debugging really hard. If the child happen to be leave, we may get React warnings too.
from cf-ui.
Related Issues (20)
- Migrate `cf-component-progress` to fela.
- Migrate `cf-component-list` to fela. HOT 1
- `cf-component-label` throws an error HOT 3
- CHANGELOG for components? HOT 5
- Fixed HEX codes in `cf-style-const` HOT 15
- Fix snapshot tests to not to generate new class name hashes
- Performance metrics of smart CSS in JS HOT 4
- [Question] Query regarding the approach taken for styleguide HOT 4
- Rename cf-style-container HOT 2
- Convert cf-component-form back to React component classes HOT 1
- Icon sizes are wrong in cf-component-icon HOT 5
- Migrate `cf-component-link` to fela. HOT 1
- Migrate `cf-component-icon` to fela. HOT 2
- Missing cf-component-viewport and flex HOT 4
- Fix invalid propType error on input HOT 1
- Enforce commit messages in CI HOT 1
- Update README for all Fela components HOT 1
- Fix drop down top arrow HOT 1
- Import strategy in your main applications HOT 3
- Will this repository become updated again? HOT 1
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 cf-ui.