This file contains 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
export default function App() { | |
const [press, setPress] = useState(false); | |
const [pressed, setPressed] = useState(false); | |
useEffect(() => { | |
setPressed(true); | |
}, [press]); | |
return ( | |
<div className="App"> |
This file contains 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 "./styles.css"; | |
export default function App() { | |
const [press, setPress] = useState(false); | |
const [pressed, setPressed] = useState(false); | |
let initialRender=true; | |
useEffect(() => { | |
if(initialRender){ |
This file contains 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, useRef, useEffect } from "react"; | |
import "./styles.css"; | |
export default function App() { | |
const [press, setPress] = useState(false); | |
const [pressed, setPressed] = useState(false); | |
const initialRender = useRef(true); | |
useEffect(() => { |
This file contains 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 { useEffect, EffectCallback, DependencyList, useRef } from "react"; | |
/** | |
* This hook gets called only when the dependencies change but not during initial render. | |
* | |
* @param {EffectCallback} effect The `useEffect` callback function. | |
* @param {DependencyList} deps An array of dependencies. | |
* | |
* @example | |
* ``` |
This file contains 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
<script type=”text/javascript”> | |
var authorizationCode = "<%=request.getParameter(\"code\")%>" | |
</script> |
This file contains 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
<jsp:scriptlet> | |
session.setAttribute("authCode",request.getParameter("code")); | |
session.setAttribute("sessionState", request.getParameter("session_state")); | |
</jsp:scriptlet> |
This file contains 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
<% | |
String authCode = (String) session.getAttribute("authCode"); | |
String sessionState = (String) session.getAttribute("sessionState"); | |
if(authCode == null) { | |
authCode = ""; | |
} |
This file contains 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 sample = (function(){ | |
let _privateVariable= “This is private”; | |
return { | |
SetPrivateVariable:(value)=>{ | |
_privateVariable=value; | |
} | |
} | |
})(); |
This file contains 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 pureSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader; | |
XMLHttpRequest.prototype.setRequestHeader = function(key, value) { | |
console.log(value); | |
pureSetRequestHeader.call(this, key, value); | |
}; |
This file contains 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
export default function App() { | |
const [ counter, setCounter ] = useState(0); | |
useEffect(()=>{ | |
setInterval(()=>{ | |
setCounter(counter + 1); | |
}, 1000); | |
}, []); |
OlderNewer