Skip to content

Instantly share code, notes, and snippets.

@leopard627
Created October 25, 2019 05:13
Show Gist options
  • Save leopard627/4a414863179bce25abfce6e9a5a45c9f to your computer and use it in GitHub Desktop.
Save leopard627/4a414863179bce25abfce6e9a5a45c9f to your computer and use it in GitHub Desktop.
react 에서 array의 index를 삭제하는 핸들러 패턴
deleteCharHandler = (index) => {
const text = this.state.content.split('');
text.splice(index, 1);
const updatedText = text.join('');
this.setState({content: updatedText});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment