score:2
Accepted answer
react docs have a example of this using refs
https://reactjs.org/docs/refs-and-the-dom.html
i’m also wondering the use case of wanting to do this, maybe some context could help with an answer?
score:2
try doing it like this:
import editreview from './partials/editreview'
class venuedetails extends component {
render() {
return (
<div classname="place-review-text">
<editreview ref={ref => this.child=ref } {...this.props} />
</div>
)
}
}
and call the function in parent component as this.child.oneditclick(param1,param2)
edit1:
if you have to do it with react 15.x itself what you can do it is create the function in parent and pass it as a prop to child
Source: stackoverflow.com
Related Query
- Call Child Function from Parent in Reactjs using useRef
- How to call Parent containers function from child component in Reactjs
- call child function from parent in reactjs
- react.js call parent function from child
- Call child component method from parent component in reactjs
- How to call a parent function from a child - react-native
- Unable to call child function from parent using refs with functional component
- how to call function of child in functional component from parent in react.js?
- How to call parent function from child prop React 15.5.0
- Call child component function from parent
- Call child hook function from parent using refs
- Need Reactjs help on how to properly pass this function from the parent to child button component
- call parent function from child of child component react
- Call a parent component function from a child component
- How to call React/Typescript child component function from parent component?
- How to call function in parent class component by onchange event from child component in React?
- Unable to call parent component function from child component in React
- How to setState in child component when child function called from parent component in ReactJS
- reactjs updating parent state from child in map function
- How to call child function from Parent react hook
- How to call Child function from Parent / Pass Props to a Parent component without using ref methods?
- how to call child component's method from parent component's event in Reactjs
- How to call parent function from custom child component?
- how to call a function from child components to parent component(function is in parent) without including the full component
- Call parent class method from child in ReactJS
- How to call parent function from child prop without an arg
- Incorrect value shown when calling parent function from child Reactjs
- How to call multiple instances of the same child component's function from parent
- ReactJS - Call parent method from child component and await response from parent
- Can't call function in parent component from child component using React
More Query from same tag
- Handling state and arrays of objects in React
- Single page app with REST API architecture
- how do i use the data my click handler sends me
- How to handle null state exception for map in reactJs
- Cannot vertically align button inside UL
- PureComponent decorated by mobx-react throws error about `shouldComponentUpdate` presence
- How can I create a global array in react? When I do separate operations for each index, I want them to save them in a single array
- Get URL parameter from url query
- React - problems with useState and Firebase
- Can't export action creator to component mapDispatchToProps method
- Why is filter() returning an error in my React reduxjs/toolkit slice?
- How to make only text of react bootstrap table header clickable
- react-datepicker and react-hook-forms: required not working
- Programmatically change to another key in object
- React: Which Order to "wrap" components with HOC?
- React HOC - Access wrapped component function
- Reactjs closure when passing state to component
- Aggregate Query Mongodb for Rating System
- Vite - change static assets' directoy
- Trigger function onclick when loading HTML from external source
- How to simplify this react-redux reducer state change
- Pass a query url param inside a graphql query (Next js)
- Double setState method in one function
- Split an array in 20-item parts and the leftover to vanillaJS
- How to sort list of React components based on different properties?
- htaccess with two indexes for locales
- In React, why is it rendered twice in some cases?
- React: Changing the background color of TreeSelect (antD component)
- How to get Django and ReactJS to work together?
- how to change states more efficiently?