Linked Questions

1 vote
2 answers
2k views

I want to call a function from a imported component in my parent react component. My parent component: import Customer from './Customer'; function App() { return ( <div className="App"&...
David's user avatar
  • 1,194
1 vote
1 answer
6k views

I have a Meteor+React application which I'm developing where I want to implement the login/registration functionality in a modal. I'm not sure how to open the modal from clicking my sign up or log in ...
Barry Michael Doyle's user avatar
1 vote
1 answer
711 views

I'm trying to access this.myref.current, but I can't do it when componentDidMount is called. Is there another function I can call that acts when all references are linked? Note that the issue isn't ...
Karim Abdel Hamid's user avatar
2 votes
0 answers
350 views

I have two components - <Parent/> and <Book /> <Book /> is a (hopefully) re-usable component that I've written that manages its own state. class Book extends React.component { ...
Kevin Martin Jose's user avatar
1 vote
1 answer
284 views

I am trying to access a method in a nested chilld component using refs. This is to delete data in the nested delete component. My code is as follows (simplified code): Parent Class: class Parent ...
toing_toing's user avatar
  • 2,462
0 votes
1 answer
166 views

If I have a class-based component: class MyComponent extends React.Component { state = {...} constructor(props) {...} functionIWantToCall() {...} render() {...} } That is incorporated ...
Zach Smith's user avatar
  • 9,056
0 votes
1 answer
131 views

This is my Tools.js export default class Tools extends React.Component { show() { console.log(1) } } And this is my App.js export default class App extends React.Component { ...
Parsa Nikoo's user avatar
92 votes
4 answers
100k views

I'm essentially trying to make tabs in react, but with some issues. Here's file page.jsx <RadioGroup> <Button title="A" /> <Button title="B" /> </RadioGroup> When you ...
Andy Ray's user avatar
  • 32.3k
14 votes
5 answers
35k views

I have requirement to call child component method from parent component in reactjs. I have tried using refs but not able to do it. Can anyone please suggest any solution. Thanks.
Rajan Gupta's user avatar
14 votes
2 answers
15k views

I want to write a Form component that can export a method to validate its children. Unfortunately a Form does not "see" any methods on its children. Here is how I define a potential children of Form: ...
Ivan Mushketyk's user avatar
5 votes
5 answers
19k views

I was wondering if it were possible to call a child's function inside the parent? For example, can I use useRef to create a reference to the child and then call the function like that? Or is there ...
Papi's user avatar
  • 345
4 votes
1 answer
24k views

It is possible to export a function that is inside a functional component and that can be imported into another? Example code: https://codesandbox.io/s/blissful-sanne-chk5g?file=/src/App.js:0-275 ...
JGPcode's user avatar
  • 177
7 votes
4 answers
16k views

I have two components: parent child The parent is class component and child is functional component. What is best practice to call child methods from the parent component? The goal of these ...
Rohullah Rajaee Rad's user avatar
7 votes
1 answer
13k views

I am using react hooks and useRef to call a child method from the parent (see here: Call child method from parent) Specifically, I am trying to call the formik submitForm method which is located in ...
wei's user avatar
  • 687
2 votes
3 answers
8k views

I have simple component called List which is a simple ul with some li inside. Each li is a simple component. I have other parent component which render one input field and the List component. Tapping ...
user3528466's user avatar

15 30 50 per page
1
2 3 4 5
8