reactjs / react-autocomplete

WAI-ARIA compliant React autocomplete (combobox) component
MIT License
2.17k stars 532 forks source link

Add basic implementation to readme #242

Closed marcofugaro closed 7 years ago

marcofugaro commented 7 years ago

I'm having difficulty setting up react-autocomplete for the first time, I looked at the examples but you have to dig into them which is not ideal.

Just a basic working implementation before the API section in the readme would suffice.

rssteffey commented 7 years ago

Hey Marco, I'm looking into trying to simplify an implementation for quick reference, but I think it may actually be more confusing to try and minimize what the examples already provide. Due to the nature of an autocomplete list, there are several critical parts to getting any sort of functionality.

The static-data app.js file is just about the cleanest implementation with the most fundamental pieces. (and 'utils.js' provides most of the business logic that determines what the content ends up as) It might be a good starting place if you're trying to make sense of the functionality

CMTegner commented 7 years ago

Hi! I added a basic example to the README. As @rssteffey said, it's not entirely trivial to reduce the functionality down to a single universal example, since there are a few different ways in which you can use Autocomplete.

Just out of curiosity, what do you experience is tough/unnecessary when using the examples as a reference for implementation?

Anyway, hope this helps!

marcofugaro commented 7 years ago

@CMTegner thank you! that is helpful for newcomers.

I had problems understanding that getItemValue and renderItem were required at first, I somehow thought it worked out of the box with a simple div or an array of strings inside items

CMTegner commented 7 years ago

The required props are getItemValue, items, and renderItem. Would it have been easier to understand if we marked the required props accordingly in the documentation instead of/in addition to marking the optional ones?