Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to replace output in input? #9

Closed
webdevyriy opened this issue Nov 7, 2022 · 4 comments
Closed

How to replace output in input? #9

webdevyriy opened this issue Nov 7, 2022 · 4 comments

Comments

@webdevyriy
Copy link

  const handleRender = (option) => {
    return typeof option === 'string' ? option : option.formatted_address
  }

 return (
    <AddressSearchAutocomplete
      value={value}
      getOptionLabel={(option) => handleRender(option) }

Replacing output results in an error

image

How can you avoid it?

@Zenoo
Copy link
Owner

Zenoo commented Nov 7, 2022

There is no formatted_address prop in the option object.

Also you should avoid creating useless lambdas like you are doing, simply pass the callback directly:

getOptionLabel={handleRender}

@webdevyriy
Copy link
Author

Please give an example of how I can change the output I work on jsx, without typescript

@Zenoo
Copy link
Owner

Zenoo commented Nov 7, 2022

It depends on what you want to display, you have all the documentation on the README

@webdevyriy
Copy link
Author

It depends on what you want to display, you have all the documentation on the README

Thank you for your attention

@Zenoo Zenoo closed this as completed Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants