React : error after pressing decimal

I’m getting this error after pressing decimal after using =
eg : - 12.2 + 3 = 15.5 works but as I press decimal the error is displayed

_this.state.displayTitle.includes is not a function

this.state.displayTitle is going to be of type Number, not String.

Numbers do not have the includes method on them. You can cast/convert the type to a string first !String(this.state.displayTitle).includes(".").

1 Like