CopyPastor

Detecting plagiarism made easy.

Score: 0.8058956265449524; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2018-12-10
by Asteriscus

Original Post

Original - Posted on 2015-10-05
by mpen



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Rather than checking whether the user is authenticated or not everywhere, why don't you just check in switch case?
{routes.map((route, idx) => { return route.component ? ( <Route key={idx} path={route.path} exact={route.exact} name={route.name} render={props => user.authUser!=null ( <route.component {...props} /> ) : ( <Redirect to={{ pathname: "/login" }} /> ) } /> ) : null; })} <Redirect from="/" to="/dashboard" />
If you're already using lodash, the [`_.times`](https://lodash.com/docs#times) function is handy.
import React, { Component } from 'react'; import Select from './Select'; import _ from 'lodash'; export default class App extends Component { render() { return ( <div className="container"> <ol> {_.times(3, i => <li key={i}> <Select onSelect={this.onSelect}> <option value="1">bacon</option> <option value="2">cheez</option> </Select> </li> )} </ol> </div> ); } }

        
Present in both answers; Present only in the new answer; Present only in the old answer;