8000 GitHub - Limlight86/Treehouse-Clone: ReactJS app done for Tommy's class, features Express, React Router
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Limlight86/Treehouse-Clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Useful links for syntax / conventions that may be unfamiliar

Square bracket property accessor for objects

const topic = "html"
const courses = {
  html: [...ArrayOfHTMLCourses],
  css: [...ArrayOfCSSCourses],
  javascript: [...ArrayOfJavascriptCourses]
}[topic]
// courses === [...ArrayOfHTMLCourses]

Curried functions / Currying

const handleInputChange = field => event => {
  this.setState({ [field]: event.target.value })
}

classNames

const foo = "truthyString"
const isActive = true
<div className={classNames('regular-class1', 'regular-class2', 'regular-class3')} />
<div className={classNames(foo ? "truthy-ternary-class" : "falsey-ternary-class" />
<div className={classNames({ applyThisClassIfValueIsTrue: isActive })} >

Best practices with react import / exports

// src/components/index.js
export { default as Form } from './Form'
export { default as Navbar } from './NavBar'
export { default as Button } from './Button'

// src/App.js
import { Form, NavBar, Button } from './components'

Async await vs then()

  // then()
  fetchData = () => {
    axios.get('INSERT_URL_HERE')
    .then(response => this.setState({ data: response.data }))
  }

  // async await
  fetchData = async () => {
    const response = await axios.get('INSERT_URL_HERE)
    this.setState({ data: response.data })
  }

Underscore vs parenthesis for arrow fuctions with no parameter

const someFunctionWithNoParameter = _ => {
  console.log('hello world')
}

https://jaketrent.com/post/javascript-arrow-function-no-params/

Javascript syntax style guide

About

ReactJS app done for Tommy's class, features Express, React Router

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0