In React's terminology, there are five core types that are important to distinguish:
React Elements
| const MyContext = React.createContext(defaultValue); // creates a context object | |
| /* A component who will subscribe to the above context will read the current | |
| context value from the closest matching Provider when React renders the component. */ | |
| /* The defaultValue argument is only used when a component does not have a matching | |
| Provider above it in the tree. */ | |
| <MyContext.Provider value={/* some value */}> |
| exports.host = functions.https.onRequest((req, res) => { | |
| const userAgent = req.headers['user-agent'].toLowerCase(); | |
| let indexHTML = fs.readFileSync('./hosting/index.html').toString(); | |
| const path = req.path ? req.path.split('/') : req.path; | |
| const ogPlaceholder = '<meta name="functions-insert-dynamic-og">'; | |
| const metaPlaceholder = '<meta name="functions-insert-dynamic-meta">'; | |
| const isBot = userAgent.includes('googlebot') || | |
| userAgent.includes('yahoou') || | |
| userAgent.includes('bingbot') || |
In React's terminology, there are five core types that are important to distinguish:
React Elements
| #!/bin/bash | |
| for file in $(git diff --cached --name-only | grep -E '\.(js|jsx)$') | |
| do | |
| git show ":$file" | node_modules/.bin/eslint --stdin --stdin-filename "$file" # we only want to lint the staged changes, not any un-staged changes | |
| if [ $? -ne 0 ]; then | |
| echo "ESLint failed on staged file '$file'. Please check your code and try again. You can run ESLint manually via npm run eslint." | |
| exit 1 # exit with failure status | |
| fi | |
| done |
| #!/bin/sh | |
| STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$") | |
| ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint" | |
| if [[ "$STAGED_FILES" = "" ]]; then | |
| exit 0 | |
| fi | |
| PASS=true |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <link rel="stylesheet" type="text/css" href="./css/style.css" /> | |
| </head> | |
| <body> | |
| <div id="container"> | |
| <div id="card"> | |
| <img src="./john_doe.png" class="img-profile" alt="profile pic"/> | |
| <p>John Doe</p> |
| /*jslint node: true */ | |
| "use strict"; | |
| var express = require("express"), | |
| consolidate = require("consolidate"), | |
| Handlebars = require("handlebars"), | |
| fs = require("fs"); | |
| var app = express(); |
| Test |