Reputation: 199
I am trying to get a value/string from a JSON file which is assigned to a, that can then be passed to handleAnswerQuestion.
var a = { myData.results[count].category[count] }
<TrueButton onPress={() => this.handleAnswerQuestion(a)}>
const TrueButton = styled.TouchableOpacity`
padding: 15px 25px 15px 25px;
border-radius: 50;
backgroundColor: rgba(106,227,104, 0.8);
`
Upvotes: 1
Views: 48
Reputation: 5186
You need to pass value on your custom class TrueButton. And then you can pass like this:
<TrueButton onPress={(valueFromCustomClass) => this.handleAnswerQuestion(valueFromCustomClass)}>
valueFromCustomClass is a value which you passed from your custom class.
Upvotes: 1