This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Good ol' ternary | |
<div>{condition ? <span /> : null}</div> | |
// AND | |
<div>{condition && <span />}</div> | |
// Multiple elements | |
<div>{condition ? [<span />, <span />] : null}</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import { connect } from 'react-redux' | |
import { FormControl, FormGroup } from 'react-bootstrap' | |
import { Link } from 'react-router-dom' | |
import { login } from '../Actions' | |
class SignIn extends Component { | |
constructor(props) { | |
super(props) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import { connect } from 'react-redux' | |
import { FormControl, FormGroup } from 'react-bootstrap' | |
import { register } from '../Actions' | |
class SignUp extends Component { | |
constructor() { | |
super() | |
this.state = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The for loop performs much faster | |
function nFactorial (num) { | |
let factorial = 1; | |
for (let i = 1; i <= num; i++) { | |
factorial *= i; | |
} | |
return factorial; | |
} | |
// Recursion is about 11× slower |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import axios from 'axios'; | |
import url from '../../config'; | |
import './SearchResult.css'; | |
class SearchResult extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
upVote: this.props.results.VOTES.UP, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import SearchResult from './SearchResult.js'; | |
import url from '../../config'; | |
import axios from 'axios'; | |
class Search extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
filter: 'SUBJECT', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Future versions of Hyper may add additional config options, | |
// which will not automatically be merged into this file. | |
// See https://hyper.is#cfg for all currently supported options. | |
module.exports = { | |
config: { | |
visor: { | |
hotkey: 'Control+`', | |
position: 'right', // or left, right, bottom | |
width: 900, // Optional, defaults to half of viewable area for horizontal positions, 100% for vertical |
NewerOlder