moroshko / react-autosuggest

WAI-ARIA compliant React autosuggest component
http://react-autosuggest.js.org
MIT License
5.97k stars 587 forks source link

extends Autosuggest #394

Open RahulGf4 opened 7 years ago

RahulGf4 commented 7 years ago

If you have ideas how to extend the Autosuggest API to support your new feature, please share!

import Autosuggest from 'react-autosuggest';
import React from 'react';

const renderSuggestionDefault = suggestion => <span>
    <h1>default</h1>
    {suggestion.name}
</span>;

class Myautosuggest extends Autosuggest {

  static defaultProps = {
    renderSuggestion: renderSuggestionDefault
  };

  constructor(props) {
    super(props)
  }

}
class Myautosuggest extends Component {

 return (
      //required
      <Cebautosuggest
        suggestions={suggestions}
        getSuggestionValue={getSuggestionValue}
        onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
        onSuggestionsClearRequested={this.onSuggestionsClearRequested}
        inputProps={inputProps}
      />
    );
}

if i am not passing renderSuggestion method it will take my renderSuggestionDefault .please any one guide and help me.

aarondack commented 7 years ago

Can you give a little more detail on what you are trying to achieve here? I see you aren't passing renderSuggestion as a prop which is required.

grahul commented 7 years ago

I want to extend the react-autosuggest. as a new wrapper class like (Myautosuggest) where I can do my new stuff.like example

please see this picture it will clear your doubt.