children of div code example
Example 1: css all children of type
/* Affects all a inside the #nav element: */
#nav a{
color: black;
}
Example 2: javascript get children
// React-Javascript
// Pass the children as either wrapping a html element around another
// element.
import React from 'react'
class wrapEle extends React.Component {
render() {
return (
<div>
// the "this" refers to the class Element so your accessing the props
// and grabbing the children
{this.props.children}
</div>
)}
}
class otherEle extends React.Component {
render() {
return (
<wrapEle>
<div>
im the child element
</div>
</wrapEle>
)}
}