How to embed React components in the details?

The only way I know to embed the details in a component is through a parent component such as

render() {
  return <Child ...this.someProps />
}

How can I add additional details to a component Childdynamically using such a function

inject(someProps, Child)

Similar to how the reduction-response effect works connect(mapStateToProps, mapDispatchToProps)(Child)

+4
source share
1 answer

Higher order components are what you are looking for: https://gist.github.com/sebmarkbage/ef0bf1f338a7182b6775

At the end of the day, you will wrap your component with the parent ( connectactually a component).

+2
source

Source: https://habr.com/ru/post/1625597/


All Articles