onRemove handler not working in version with custom valueComponent
See original GitHub issueIn version ^1.0.0-rc.10
this is not working.
Select component:
<Select.Async
name="signal-filter"
className={styles.selectSignals}
placeholder={signalsPlaceholder}
searchPromptText="Type to search (at least 2 characters)"
value={values}
valueComponent={TrendsSelectValue}
loadOptions={this.getSignalsOptions}
onChange={this.onChangeTicketsSignals}
isLoading={this.props.isLoadingSignals}
disabled={isLoadingSignals || isLoadingOntology || isFilteringTickets || isLoadingTickets || isLoadingMonthTickets}
delimiter={getReactSelectDelimiter()}
simpleValue
multi
/>
Value component:
import React, {Component} from 'react';
import classNames from 'classnames';
import {trendSearchSeparators} from '../../../../utils/constants';
import styles from './TrendsSelectValue.less';
export default class TrendsSelectValue extends Component {
render() {
const isSeparator = this.props.value.label.indexOf(`__${trendSearchSeparators.and}__`) !== -1;
if (isSeparator) {
const separatorClass = classNames({
'Select-value': true,
[styles.separator]: true
});
return <div className={separatorClass}>
<span className="Select-value-label">{trendSearchSeparators.and.toUpperCase()}</span>
</div>
}
return <div className="Select-value">
<span className="Select-value-icon" onClick={this.props.onRemove}>×</span>
<span className="Select-value-label">{this.props.value.label}</span>
</div>
}
}
In previous version all worked fine, but in 1.0.0-rc.10
onChange
handler works after onRemove
, but with the same value, without removing
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
reactjs - Property 'onRemove' does not exist on type
Please close this task, problem is solved in another task, i attach link below. Delete an element by key from Array.
Read more >Developer Guide: Components - AngularJS: API
In AngularJS, a Component is a special kind of directive that uses a simpler configuration which is suitable for a component-based application structure....
Read more >React Hooks - Understanding Component Re-renders - Medium
Here is the modified version of the onRemove handler without a dependency on the watchlist array. The inner function gets the current watchlist ......
Read more >MultiSelect - Mantine
MultiSelect support two different data formats: An array of strings – use when you do not need to customize item component or display...
Read more >Components - React Select
The problem here isn't just about performance — remounting a component causes ... Control> )}} /> ) // Good: Custom component declared outside...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to pass the
value
property from theprops
to theonRemove
function.Inline it should look like this:
Hello -
In an effort to sustain the
react-select
project going forward, we’re closing old issues.We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version.
If you aren’t using the latest version of
react-select
please consider upgrading to see if it resolves any issues you’re having.However, if you feel this issue is still relevant and you’d like us to review it - please leave a comment and we’ll do our best to get back to you!