I have a React component with a componentDidUpdate function which checks for a change in the props and then sets the state. This works. However I also want to update the state within the component, but when componentDidUpdate is called again, it is updating the state again to the props which is wrong as the props are now redundant. How do I fix this?