0.4.8 • Published 7 years ago
react-comp-children v0.4.8
react-comp-children
A react component that makes easy to mount children dynamically.
Installation
npm install --save react-comp-children
Examples
Activate one of children
import Children from 'react-comp-children';
...
render() {
const items = [<A />, <B />, <C />];
return (
<div>
<Children items={ items } active={ 1 } />
</div>
);
}
...
equals to
...
<div>
<B />
</div>
...
for array items - inline
import Children from 'react-comp-children';
...
render() {
const items = [<A />, <B />, <C />];
return (
<div>
<Children items={ items } active={ [0, 2] } />
</div>
);
}
...
equals to
...
<div>
<A /><C />
</div>
...
for array items - block
import Children from 'react-comp-children';
...
render() {
return (
<div>
<Children active={ [0, 2] }>
<A />
<B />
<C />
</Children>
</div>
);
}
...
equals to
...
<div>
<A /><C />
</div>
...
for object items
import Children from 'react-comp-children';
...
render() {
const items = {
a: <A />,
b: <B />,
c: <C />,
};
return (
<div>
<Children items={ items } active={ ['a', 'b'] } />
</div>
);
}
...
equals to
...
<div>
<A /><B />
</div>
...
License
MIT
0.4.8
7 years ago
0.4.7
7 years ago
0.4.6
7 years ago
0.4.5
7 years ago
0.4.4
7 years ago
0.4.3
7 years ago
0.4.2
7 years ago
0.4.1
7 years ago
0.4.0
7 years ago
0.3.8
7 years ago
0.3.7
7 years ago
0.3.6
7 years ago
0.3.5
7 years ago
0.3.4
7 years ago
0.3.3
7 years ago
0.3.2
7 years ago
0.3.1
7 years ago
0.3.0
7 years ago
0.2.4
7 years ago
0.2.3
7 years ago
0.2.2
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago