-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
____Notification Index: -----Please ignore this issue. ---- #7776
Comments
ok. figure out one..
|
@bochen2014 If I understand correctly you are trying conditionally manipulate classnames. Have you explored classnames module? |
This is a usage question. We use github to track bugs in the react core, rather than usage questions. A more appropriate place for usage questions is StackOverflow, so I'm going to close out this issue, but feel free to continue the conversation on this thread or move the discussion over to StackOverflow. |
nodejs event loop: https://www.youtube.com/watch?v=8aGhZQkoFbQ how react render works: https://github.com/facebook/react/issues/-7761 React.findDOMNode v.s. this.refs.item: mui/material-ui#1594
https://github.com/facebook/react/issues/-654 redux typescript jest mock named import: jestjs/jest#1557 Relay Classic |
style-guidist argv tools : docker ramda ngReact: https://plnkr.co/edit/INGGHD?p=preview github search syntax: https://help.github.com/articles/searching-issues-and-pull-requests/ |
ref with stateless componenents. use import React, { Component } from 'react';
import {
StyleSheet,
View,
Text,
TouchableOpacity
} from 'react-native';
import { color, fontSize } from '../../common';
const optionLabels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'];
const QuizAnswerOptionComponent = (props) => {
// ***************************************
let _text = null;
// ***************************************
const handlePressed = e => {
_text.setNativeProps({
style: {
color: isCorrectAnswer ? color.green : color.red
}
});
}
const { index, text, hint, isCorrectAnswer } = props;
return <TouchableOpacity onPress={handlePressed}>
<Text ref={ref => _text = ref} style={styles.optionText}>{optionLabels[index] + '): ' + text}</Text>
</TouchableOpacity>
}
const styles = StyleSheet.create({
optionText: {
fontSize: fontSize.default
}
})
export default QuizAnswerOptionComponent; |
How to refer to the DOM element within JSX props (without using ref)?
same as: https://discuss.reactjs.org/t/passing-this-to-the-onclick-callback/437
23/2/2017 update:
the answer is no. you can't use this.
this
always stands for the current component no matter where you use it. the correct approach is to pass thethis object
explicitly. e.g.you know that
this
refer tooption1
so you can pass the value directly without usingthis
keyword@bochen2014
The text was updated successfully, but these errors were encountered: