This repository was archived by the owner on Jun 13, 2023. It is now read-only.
This repository was archived by the owner on Jun 13, 2023. It is now read-only.
Re-rendering view on initial tags change #65
Open
Description
Hey @peterp, first of all, awesome library 🙌
Maybe what I'm doing is out of the scope of this project. I've basically built a wrapper that the user can select/deselect a tag between a list of tags. Similar to setting your interests in various apps. Everything works perfectly apart from re-rendering the view on the initialTags
prop change. I had a look at your code and it seems that it's like that by design.
I've solved my issue by re-setting the state tags when the props tags change.
componentDidUpdate(prevProps) {
if (JSON.stringify(prevProps.initialTags) !== JSON.stringify(this.props.initialTags)) {
this.setState({ tags: [...this.props.initialTags] });
}
}
Is there another way to re-render the view?
Metadata
Metadata
Assignees
Labels
No labels