Skip to content

Instantly share code, notes, and snippets.

@modster
Last active December 14, 2021 23:49
Show Gist options
  • Save modster/de9ee6e89b0c1b7adad4ca0a4bb35728 to your computer and use it in GitHub Desktop.
Save modster/de9ee6e89b0c1b7adad4ca0a4bb35728 to your computer and use it in GitHub Desktop.
React Notes

📌 React Notes ⚡️

React is the entry point to the React library.

  • If you use ES6 with npm, you can write import React from 'react'
  • If you use ES5 with npm, you can write var React = require('react')
  • If you load React from a <script> tag, these top-level APIs are available on the React global:
<script crossorigin src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>

The versions above are only meant for development, and are not suitable for production. Minified and optimized production versions of React are available at:

<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>

Public Folder:

render() {
  // Note: this is an escape hatch and should be used sparingly!
  // Normally we recommend using `import` for getting asset URLs
  // as described in “Adding Images and Fonts” above this section.
  return <img src={process.env.PUBLIC_URL + '/img/logo.png'} />;
}

Or: <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> https://create-react-app.dev/docs/using-the-public-folder

⚡️

delete all files in a directory: rm -f * or del *

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