You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless there already is a way to add classes to the containing div, I would suggest adding support for the (pretty common) htmlAttributes parameter.
@Html.React("MyComponent", new { data = Model }, htmlTag: "div", containerId: "my-container", htmlAttributes: new { @class = "my-class-needed-on-container" })
I can see this could be problematic if one should try to add an id using the htmlAttributes even if containerId is provided.
An alternative solution is to add a specific parameter className that takes a string of classes to add to the container. This is probably the most "sane" way to do it, since you probably do not want to allow other attributes than class to a React-container.
@Html.React("MyComponent", new { data = Model }, htmlTag: "div", containerId: "my-container", className: "my-class-needed-on-container" )
The text was updated successfully, but these errors were encountered:
My current problem is the use of child selectors in css. Since React.NET "adds an extra element" around the component, the child selector does not work unless I add another child level in the css. I could of course rewrite my other "components" to include the extra child level in the HTML also, but adding a class to the container seems like the easier path. (If you're lazy like me... ;-) )
I will try to submit a pull request. It's my first ever, so I hope I get it right! :-)
Unless there already is a way to add classes to the containing div, I would suggest adding support for the (pretty common) htmlAttributes parameter.
I can see this could be problematic if one should try to add an id using the htmlAttributes even if containerId is provided.
An alternative solution is to add a specific parameter className that takes a string of classes to add to the container. This is probably the most "sane" way to do it, since you probably do not want to allow other attributes than class to a React-container.
The text was updated successfully, but these errors were encountered: