I'm diving into ramdajs and refactoring some react code here. It might not necessary to do it in this case but for the sake of exercise how do I pass props in R.ifElse ?
{!this.state.repos ? <Loader /> : <RepoGrid repos={this.state.repos} />}
// refactoring to:
{R.ifElse(
R.isEmpty,
R.always(Loader),
RepoGrid
)(this.state.repos)}
This gives me an error Cannot read property '@@transducer/step' of null
const ReposGrid = R.pipe(
R.tap(console.log)
R.prop("repos"),
R.map(Repo),
ReposWraper
)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…