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

'action' is not defined no-undef #10

Closed
elghali opened this issue Jul 13, 2017 · 5 comments
Closed

'action' is not defined no-undef #10

elghali opened this issue Jul 13, 2017 · 5 comments

Comments

@elghali
Copy link
Collaborator

elghali commented Jul 13, 2017

<FuzzySearch ref={(node) => {this.search = node;}} list={list} keys={['title', 'label']} width={430} onSelect={action('selected')} />
i'm not sure what i'm missing here but this code fails to compile with this error: 'action is not defined no-undef',
i'm not sure how to return the chosen item to the input, i tried replacing {action('selected')} with my own method 'handleSelected':
handleSelected(event){ this.setState({ selected: event.title }) }
but i can't tell how to feed the state back to the input as there is no 'value' property for example

@ritz078
Copy link
Owner

ritz078 commented Jul 26, 2017

Is the error still there ?

@elghali
Copy link
Collaborator Author

elghali commented Jul 26, 2017

yes it is, i am using onSelect={this.handleSelected} which is my custom method, but i'm not sure if you released the last fix so it updates the value

@rcolepeterson
Copy link

Same error.
Using the example code.

@revengemiroz
Copy link

i am having the same issue any solution to it ?

@PatrickDesign
Copy link
Collaborator

i can't tell how to feed the state back to the input as there is no 'value' property for example

react-fuzzy is currently an uncontrolled component. #25 (comment)

Here is an example onSelect method to retrieve the selected value for local state:

onSelect={(newSelectedItem) => {
  // Local state setter defined elsewhere
  setSelectedItem(newSelectedItem)
}}

PatrickDesign added a commit that referenced this issue Dec 17, 2020
Avoid using `action` within the sample code, as it caused some
confusion with non-redux users. (#10)
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

5 participants