I current have a component that holds the business logic, depending on the page, I'd like to render different views. I'm having trouble since I'm not sure how to elegantly pass the functions and props of the control component into the view component.
Right now, my solution is:
<Controller viewComponent={ViewComponent} />
And then rendering inside Controller:
<this.props.viewComponent function1={this.func} function2={this.func2} />
It works, but it's confusing and I'm almost certain its not the most elegant solution. There's also a solution with cloning, but that seems like a hack too.
Does anybody have any insight into how to solve this?
Aucun commentaire:
Enregistrer un commentaire