0

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

0

1 Answer 1

1

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} />; } } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.