Child component doesn't merge className from parent.
See original GitHub issueVue.js version
2.1.4
Reproduction Link
https://jsfiddle.net/JounQin/s5b79kqc/
Steps to reproduce
Just look at the output HTML
What is Expected?
Child comp should has className abc def
What is actually happening?
The className is abc abc def
Is that by design?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
React passing additional classNames to child component in ...
In this case, I would like the Child component div to have the "flavor" prop, and also have both classes "parent-class" and "child-class"....
Read more >Pass class names as props to React components | bobbyhadz
To pass class names as props to a React component, pass a string containing the class names as a prop. Destructure the prop...
Read more >Building React Components Using Children Props ... - Soshace
As you can see, the onOk handler needs merging, while visible and onCancel props are just passed from parent context. In this code...
Read more >When does React re-render components? - Felix Gerschau
When the state changes in the parent component (in this case, App ), the two Tile components will re-render, even though the second...
Read more >React Tips — Fix Common Errors, Multiple Classes, and ...
In this article, we'll look at some tips for writing better React apps. Add Multiple Classes to a React Component. We can use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry but I don’t really understand your use case, that seems over-engineering to me. If you really need to bind a static class
abc
twice (once in component’s template, once in parent’s template, as shown in your fiddle), you or the build system is probably doing something wrong.@yyx990803 actually it does not.
However, there is a problem when using
vue-loader
which makes me to usecomposes
.Consider two component:
Obviously I want to override the style of
.base
, but actually it does not work because the style ofBaseComp.vue
is loaded afterHello.vue
……http://test.1stg.me/