How to pass back argument from child component on React Native

Engin Yilmaz

I have three file ( The full project is https://github.com/EnginYilmaz/kpbduser)

  • MapScreen.js
    • FetchData.js
    • ShowData.js

I want to print a Map on FetchData and on marker click want to pass which markerkey pressed to MapScreen.js and then Query the people on index key and show data with ShowData.js but I don't know how to pass data back from FetchData.js to Parent (MapScreen.js). I illustrated my question on this image

Wolverine

You can use props to handle data passing in react native. A basic example is shown below

export default class ParentClass extends Component {
    callbackMethod = (value) => {
        console.log('Callback is called',value);
    };

    render() {
        return <ChildView callbackMethod={this.callbackMethod} />;
    }
}



export default class ChildView extends Component {

    onPress=()=>{
        this.props.callbackMethod("Hello");
    }
    render() {
        return <Button onPress={this.onPress} />;
    }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to pass value from parent component to child component (react)

From Dev

React Native- How to pass state from a component to it's parent

From Dev

How to get data from Form from child component and pass it back to Parent Componet?

From Dev

React Native Opacity from Parent to Child Component

From Dev

React: how to pass a object inside a child component?

From Dev

How to pass data from Child to Parent, if Child component dynamic component

From Dev

How to pass data from a child component to a parent component in React.js

From Java

How to Pass Props to Modal Component in React Native

From Dev

How to pass array of View/Component in react native?

From Dev

Pass callback function from parent component to child component react

From Dev

Trigger a function from child component and define in parent component in React Native

From Dev

Angular 2, How to pass options from parent component to child component?

From Dev

React : Pass function to child component

From Dev

How to access data in a child react component from a parent react component

From Dev

Calling a method of a parent component from child - React Native

From Dev

how to pass the results of a function from one component to another in react-native?

From Java

How to pass an object as props to a child Functional Component in React.js?

From Java

React.js -- How to pass properties object to child component?

From Dev

react native : How to stop child component rerendering on state change?

From Dev

Pass Data to a Component in React Native?

From Dev

How to communicate from Child Component to Parent Component with React Router

From Dev

How to pass and execute functions as props in class Component in React Native?

From Java

How to pass data from child component to its parent in ReactJS?

From Dev

How to pass function as a prop to child component and call it from there in Vue?

From Dev

How to pass callback from one child component to another

From Dev

How to pass ngForm to child component?

From Dev

How to pass a variable to a child component?

From Dev

How to pass data from child component to parent component when button clicked on parent component

From Dev

React: How to pass state to child component and call function in child to use this state

Related Related

  1. 1

    How to pass value from parent component to child component (react)

  2. 2

    React Native- How to pass state from a component to it's parent

  3. 3

    How to get data from Form from child component and pass it back to Parent Componet?

  4. 4

    React Native Opacity from Parent to Child Component

  5. 5

    React: how to pass a object inside a child component?

  6. 6

    How to pass data from Child to Parent, if Child component dynamic component

  7. 7

    How to pass data from a child component to a parent component in React.js

  8. 8

    How to Pass Props to Modal Component in React Native

  9. 9

    How to pass array of View/Component in react native?

  10. 10

    Pass callback function from parent component to child component react

  11. 11

    Trigger a function from child component and define in parent component in React Native

  12. 12

    Angular 2, How to pass options from parent component to child component?

  13. 13

    React : Pass function to child component

  14. 14

    How to access data in a child react component from a parent react component

  15. 15

    Calling a method of a parent component from child - React Native

  16. 16

    how to pass the results of a function from one component to another in react-native?

  17. 17

    How to pass an object as props to a child Functional Component in React.js?

  18. 18

    React.js -- How to pass properties object to child component?

  19. 19

    react native : How to stop child component rerendering on state change?

  20. 20

    Pass Data to a Component in React Native?

  21. 21

    How to communicate from Child Component to Parent Component with React Router

  22. 22

    How to pass and execute functions as props in class Component in React Native?

  23. 23

    How to pass data from child component to its parent in ReactJS?

  24. 24

    How to pass function as a prop to child component and call it from there in Vue?

  25. 25

    How to pass callback from one child component to another

  26. 26

    How to pass ngForm to child component?

  27. 27

    How to pass a variable to a child component?

  28. 28

    How to pass data from child component to parent component when button clicked on parent component

  29. 29

    React: How to pass state to child component and call function in child to use this state

HotTag

Archive