Open iyinolu opened 2 years ago
showLastTag function prevent placeholder from displaying on the input field. This is because the initial value of text in state is set to a whitespace instead of an empty string.
showLastTag
text
showLastTag = () => { this.setState(state => ({ tags: state.tags.slice(0, -1), text: state.tags.slice(-1)[0] || " " }), () => this.props.onChangeTags && this.props.onChangeTags(this.state.tags) ); };
Set initialText=""
Yes, This works out. Although It works only when the field is first rendered. When all input values are cleared, the placeholder will not be visible.
showLastTag
function prevent placeholder from displaying on the input field. This is because the initial value oftext
in state is set to a whitespace instead of an empty string.