0
Using .slice inside jsx in create-react-app
I tried to do str.slice(0,5) but it gives me an error "str.slice is not a function". Is there any other way to do this?
2 ответов
+ 4
Use the substring method for string.
0
I just needed to str.toString().substr(0,5). Thanks.