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

renderInputComponent if undefined, should bring back default input #41

Open
eldyvoon opened this issue Jun 29, 2018 · 1 comment
Open

Comments

@eldyvoon
Copy link

eldyvoon commented Jun 29, 2018

Are you reporting a bug?

renderInputComponent is not optional? when it's undefined it should render the default input component. For now I have to do this


if (custom) {
  return (
    <Autosuggest
      {...props}
      renderInputComponent={() => this.customComponent()}
    />
  )
}

return `<Autosuggest  {...props} renderInputComponent={() => this.customComponent()} />`

I expect it work like below where I can put condition in jsx, but it does not

return <Autosuggest {...props} renderInputComponent={custom ? () => this.customComponent : undefined} />

Above code initially show a blank input when renderInputComponent is optional.

@tdhung80
Copy link

tdhung80 commented May 5, 2019

Hi,

Just not to specify a render function to renderInputComponent, it would work. In your case, code should be

`
if (custom) return <Autosuggest {...props} renderInputComponent={ this.customComponent } />

return <Autosuggest {...props} />
`

My Bests,
Hung Tran

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