Skip to content

Instantly share code, notes, and snippets.

@imralpharvin
Created September 13, 2020 20:46
Show Gist options
  • Save imralpharvin/db795d92ff8b8a05b486d3a635e1597e to your computer and use it in GitHub Desktop.
Save imralpharvin/db795d92ff8b8a05b486d3a635e1597e to your computer and use it in GitHub Desktop.
ReactJS

ReactJS

What is ReactJS

Environment

start server

npm start

Open up live server

Index.css

Styling

COMPONENTS

  • File that holds all the html, logic, styling
  • Self-contained piece of code

App.js

  • Import react
  • Function
  • Export default app
  • Export file
  • return()- jsx code (kinda like html code)
  • Logic code - before return
  • Javascript braces in HTML code

NewFile.js

  • Put normal react structure
  • Import in app.js
  • Render in app.js like html element

Index.js

  • Mounts react app
  • Reactdom.render app.js, index.html
  • No html

Index.html

  • Only one div, root

App.css

  • Styling
  • Classname = in file.js code
  • Use it for components

Props or {}

  • Parameter in function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment