I’m creating a react native mobile app and I’m using the open trivia db API. I seem to be stuck on decoding the questions and answers. Right now its displaying
Which Shakespeare play inspired the musical 'West Side Story'?
I would like to display the decoded version
Which Shakespeare play inspired the musical 'West Side Story'?
This is the component I have rendering to the screen
import React from 'react'
import { View, Text } from 'react-native'
export default class Question extends React.Component<*> {
render() {
return (
<View>
<View>
<Text>Category: {this.props.category}</Text>
<Text>Question #: {this.props.nr} of {this.props.total}</Text>
</View>
<View>
<Text>{decodeURI(this.props.question)}</Text>
</View>
</View>
)
}
}
If I were to replace decodeURI() with encodeURI() it encodes it but for some reason seems to ignore the decode function.
Any help would be greatly appreciated.
Thanks