how to remove warnings in react js console

JavaScript
how to remove last word in string
Source

Also in JavaScript: