0

I am trying to create an app that will take source and destination location from the autocomplete box and the map shows the route between the two points:

ScreenShot:

I have used the two useState to store the value for Source and Destination. After that, I am passing those two values as props to my Routing component. But the problem is that in my Routing component I am receiving the props data for destination as 'undefined'.

Please find my sandbox code here.

Note: In above code for now I have directly set the coordinates for Destination.

I am not able to figure out why it is behaving this way. Is there a way to achieve this?

1 Answer 1

1

You have a typo in the prop you are passing in App component and the prop you are receiving in Routing.

You are passing desitinationCity prop while you are expecting destinationCity prop so therefore it is always undefined.

Demo

Sign up to request clarification or add additional context in comments.

1 Comment

Oh! Damn it. Thanks Yes just now realized.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.