Subcomponents
Basic example
import Recks from 'recks';
function Parent () {
return <div>
Hello, <Child /> !
</div>
}
function Child () {
return <span>child</span>
}Props
import Recks from 'recks';
import { timer } from 'rxjs';
import { map } from 'rxjs/operators';
function Parent () {
return <div>{
timer(0, 1000).pipe(
map(i => <Child index={i} />)
)
}</div>
}
function Child (props$) {
const animal$ = props$.pipe(
map(props => props.index % 2 ? '🐱' : '🐭')
)
return <h1 style="text-align: center;">{animal$}</h1>
}Last updated
Was this helpful?