Before getting to React, it's helpful to know what this does generally in Javascript.
Take the following snippet of code. It's written in ES6 but the principles for this
predate ES6.
class Dog {
constructor() {| export const getServerSideProps = withPageAuthRequired({ | |
| async getServerSideProps(context) { | |
| return { props: {} }; | |
| }, | |
| }); |
| function setRolesToUser(user, context, callback) { | |
| const namespace = 'http://my-website-name.com'; | |
| const assignedRoles = (context.authorization || {}).roles; | |
| let idTokenClaims = context.idToken || {}; | |
| let accessTokenClaims = context.accessToken || {}; | |
| idTokenClaims[`${namespace}/roles`] = assignedRoles; | |
| accessTokenClaims[`${namespace}/roles`] = assignedRoles; |
| const { MongoClient } = require('mongodb'); | |
| /** | |
| * Handler that will be called during the execution of a PostUserRegistration flow. | |
| * | |
| * @param {Event} event - Details about the context and user that has registered. | |
| */ | |
| exports.onExecutePostUserRegistration = async (event) => { | |
| let uri = event.secrets.MONGODB_URI; | |
| let dbName = event.secrets.MONGODB_DB; |
| const submitUpdate = async (e, propertyName) => { | |
| e.preventDefault(); | |
| const res = await fetch('http://localhost:3000/api/landing', { | |
| body: JSON.stringify({ | |
| [propertyName]: e.target[propertyName].value, | |
| }), | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| }, |
| import React, { Component, Fragment } from 'react'; | |
| import ReactModal from 'react-modal'; | |
| import { connect } from 'react-redux'; | |
| import { fetchPlaylistTracks } from '../actions/index'; | |
| import TracksModalContent from './TracksModalContent'; | |
| ReactModal.setAppElement('#root'); // ReactModal use for screen readers (see docs) | |
| const buttonDivStyle = { | |
| flex: '100%' |
| git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" | |
| You've now created an alias to git log called git lg that will display the nicer output showed before. Try it out by typing git lg (or git lg -p to see the lines that have changed). | |
| https://dev.to/christopherkade/up-your-git-game-and-clean-up-your-history-4j3j?utm_source=digest_mailer&utm_medium=email&utm_campaign=digest_email |
| function stairs(num) { | |
| for (let row = 0; row< num; row++) { | |
| let level = ""; | |
| for (let column = 0; column< num; column++){ | |
| if (column <= row) { | |
| level += "#"; | |
| } | |
| else { | |
| level += " "; |
| function strRev(str) { | |
| let left = 0; | |
| let right = str.length-1; | |
| const strArr = str.split(""); | |
| while (left < right) { | |
| let tempLeft = strArr[left]; | |
| let tempRight = strArr[right]; | |
| strArr[left] = tempRight; | |
| strArr[right] = tempLeft; |
| class Node { | |
| constructor(value) { | |
| this.value = value; | |
| this. next = null; | |
| } | |
| } | |
| class LinkedList { | |
| constructor(value) { |