static getDerivedStateFromProps(props, state) { const soundObject = new Audio.Sound(); const didPurr = props.cuddles > state.cuddles; const didScratch = props.scratches > state.scratches; (async function (purred, scratched) { try { if (purred) { // Purr await soundObject.loadAsync(purrSound); await soundObject.playAsync(); } if (scratched) { // Scratch await soundObject.loadAsync(screamSound); await soundObject.playAsync(); } } catch (e) { // Log error } }(didPurr, didScratch)); return props; }