Skip to content

Instantly share code, notes, and snippets.

View gminova's full-sized avatar
:octocat:
Focusing

Gergana ゲルガナ gminova

:octocat:
Focusing
View GitHub Profile
@gminova
gminova / conditional_styles.jsx
Last active November 25, 2019 13:34
FCC - React Conditional Styles
class GateKeeper extends React.Component {
constructor(props) {
super(props);
this.state = {
input: ''
};
this.handleChange = this.handleChange.bind(this);
}
handleChange(event) {
this.setState({ input: event.target.value })
@gminova
gminova / conditional_prop.jsx
Created November 25, 2019 11:55
FCC - React Render with conditional prop
class Results extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<h1>
{this.props.fiftyFifty}
</h1>
)
@gminova
gminova / ternary_operator.jsx
Created November 24, 2019 00:16
FCC - React Conditional Rendering Ternary Operator
const inputStyle = {
width: 235,
margin: 5
}
class CheckUserAge extends React.Component {
constructor(props) {
super(props);
// change code below this line
this.state = {
@gminova
gminova / toggle_display.jsx
Last active November 23, 2019 23:54
FCC - React Toggle Display
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
display: true
}
this.toggleDisplay = this.toggleDisplay.bind(this);
}
toggleDisplay() {
this.setState(state => ({
@gminova
gminova / magic_ball.jsx
Created November 23, 2019 22:59
FCC - React Magic Ball
const inputStyle = {
width: 235,
margin: 5
}
class MagicEightBall extends React.Component {
constructor(props) {
super(props);
this.state = {
userInput: '',
@gminova
gminova / styles.jsx
Created November 23, 2019 22:05
FCC - React Styles
const styles = {
color: "purple",
fontSize: 40,
border: "2px solid purple"
}
// change code above this line
class Colorful extends React.Component {
render() {
// change code below this line
return (
@gminova
gminova / event_listeners.jsx
Created November 23, 2019 18:19
FCC - React Event Listeners
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
message: ''
};
this.handleEnter = this.handleEnter.bind(this);
this.handleKeyPress = this.handleKeyPress.bind(this);
}
// change code below this line
@gminova
gminova / event_listeners.jsx
Created November 23, 2019 18:19
FCC - React Event Listeners
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
message: ''
};
this.handleEnter = this.handleEnter.bind(this);
this.handleKeyPress = this.handleKeyPress.bind(this);
}
// change code below this line
@gminova
gminova / componentWillMount.jsx
Created November 22, 2019 16:57
FCC - React componentWillMount()
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
activeUsers: null
};
}
componentDidMount() {
setTimeout( () => {
this.setState({
@gminova
gminova / callback_as_props.jsx
Created November 22, 2019 16:40
FCC - React Pass a Callback as Props
class MyApp extends React.Component {
constructor(props) {
super(props);
this.state = {
inputValue: ''
}
this.handleChange = this.handleChange.bind(this);
}
handleChange(event) {
this.setState({