This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Parent = () => { | |
const [showParams, setShowParams] = useState(true); | |
const [results, setResults] = useState({}) | |
const [params, setParams] = useState({}); | |
const toggleShowParams = () => { | |
setShowParams(!showParams); | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Parent = () => { | |
const [dialogOpen, setDialogOpen] = useState(false); | |
const [showParams, setShowParams] = useState(true); | |
const [results, setResults] = useState({}) | |
const [paramsHaveChanged, setParamsHaveChanged] = useState(false); | |
const [params, setParams] = useState({}); | |
const toggleShowParams = () => { | |
setShowParams(!showParams); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is my function that I pass to each button in my form - | |
// function to change color on click | |
const toggleButtonColor = (event: { target: HTMLInputElement }) => { | |
event.target.getAttribute('colorScheme') === INITIAL_BUTTON_COLOR | |
? event.target.setAttribute('colorScheme', 'blue') | |
: event.target.setAttribute('colorScheme', INITIAL_BUTTON_COLOR) | |
} | |
// form gets the function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
/** | |
* Sends an email to the recipient in the body of the request | |
*/ | |
send: async (ctx) => { | |
const body = ctx.request.body | |
const sendTo = body.email | |
strapi.log.debug(`Trying to send an email to ${sendTo}`) | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from 'react'; | |
import './App.css'; | |
import { BrowserRouter, useHistory } from 'react-router-dom'; | |
import Navigation from './routes-nav/Navigation'; | |
import Footer from './components/Footer'; | |
import Routes from './routes-nav/Routes'; | |
import BannerBar from './components/BannerBar'; | |
import UserContext from './auth/UserContext'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def minUniqueSum(arr): | |
if len(arr) == 0: | |
return arr | |
arr.sort() | |
sum = 0 | |
i = 1 | |
prev = arr[0] | |
curr = arr[i] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def meander(unsorted): | |
unsorted.sort() | |
meander_arr = [] | |
small = 0 | |
large = -1 | |
while(unsorted[small] != unsorted[large]): | |
meander_arr.append(unsorted[large]) | |
meander_arr.append(unsorted[small]) | |
small = small + 1 | |
large = large - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useRef, useState, useEffect } from "react"; | |
/** Custom hook for managing "flash" messages. | |
* | |
* This adds an item in state, `active`, which can be controlled by the | |
* component as desired. The component would typically `setActive(true)` | |
* to start displaying the message, and after `timeInMsec`, active would | |
* go back to false, which would typically stop showing the message. | |
* | |
* In the component:: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MatchCard() { | |
const [isLoading, setIsLoading] = useState(false); | |
const [isMatch, setIsMatch] = useState(false); | |
const [user, setUser] = useState([]); | |
/** Generates new user from randomuser.me API */ | |
async function getRandomUser() { | |
try { | |
setIsLoading(true); |