score:3
Accepted answer
you can use hoiststatic.
class basecomponent {
dosth(){...}
}
const enhance = compose(...some)
const component = hoiststatics(enhance)(basecomponent)
class app {
componentdidmount() {
this.refs.component.dosth()
}
render() {
<component ref="component" />
}
}
you can find a real example in the test.
Source: stackoverflow.com
Related Query
- How can I access the ref of the BaseComponent or any level of the components?
- how can i access the history in my react components from props?
- How can I access a functional components state outside the component? - React
- how to reference a dom node using forward ref where the two components are in the same level
- React Components - No Inheritance, how can pass ref or use HOC for my BaseComponent
- ReactJS - How can I access the displayName of a component using javascript?
- How can I call methods on Reactjs components in the browser console or from an outside script?
- How can I expose functions to the ref using functional components?
- How can I access state in an useEffect without re-firing the useEffect?
- How can i access the current hash location on react router 2?
- How can i make chakra ui components use next/image to optimize the photos automatically?
- How can I cache data that I already requested and access it from the store using React and Redux Toolkit
- How to access the Redux store from deeply nested components
- how can I make a scrollable component that scrolls to the latest children components automatically when I append a child component?
- react-grid-layout How can I resize components on the grid?
- React context consumer how to access ref on to the consuming component
- How I can access the cancellation handler from creating a new row in material-table for reactJS?
- How can I access child components values from a parent component when they are added dynamically?
- How can i write a test using React Testing Library to check if hover changes the components style?
- How can I have multiple sibling instances of the same top level fragment container?
- Redux ReactJS : How Components have access to the store?
- How can i get access to the current user inside of react from firebase?
- How can I synchronize the authenticated status of different components in React?
- How can I count the number of components on a page that have been connected with redux' connect() function?
- How can I access the custom target attribute within material UI select options in React js
- How can I access another function inside the react Context.Provider value?
- How can I pull various claims out of the access token?
- How can getDerivedStateFromProps method can access state if the state is initialized from within the constructor(props)?
- How can I access the props when the page loads?
- How can I change the style of specific components returned from map function?
More Query from same tag
- Clear Input from Textbox after Button clicked
- React-intl define messages outside of react
- Cleaner JSX for React-Router Links
- How to implement a rich text editor such as Quill or Draft.js with Next.js?
- Firebase Authentication & React
- why rendering is delayed
- Same height siblings based on parent's size
- How to get each user's keystroke when he pressed a certain key?
- Access React context outside of component
- Why won't my picture appear in ReactJS?
- exporting multiple functions but always run default function first
- How to have a dynamically height adjusted textarea without constant reflows?
- Unknown property on TransitionGroup - React Animation
- React, Material Ui, Emoji slider
- Redux objects is being submited empty on submission
- React button component asks for key props
- TypeScript + React: defining defaultProps correctly
- <select> tag in react not changing when selecting option
- Having Trouble Getting React.useCallback working as named export
- Not able to uninstall outdated, probably unused NPM packages
- Change props from imported component
- How can I correct this error in ReactJS / NodeJS / MySQL?
- How to call controller methods from react
- How to get to the top of page without scrolling
- Globally mock a function in Jest/Enzyme in React
- In a react html5 app, how to a place 3 select lists side by side?
- TypeError: movie.directors is undefined
- Accessing Parameter from Dynamic Route in Next.js
- Replace part of string with tag in JSX
- Condition on a last iteration of loop in React JSX?