Created
November 30, 2017 16:37
-
-
Save hwclass/e35e31b0176c7400cf72541506577480 to your computer and use it in GitHub Desktop.
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
Q: How many ways are there to make an AJAX call in Javascipt? | |
const url = 'http...' | |
const response = await fetch(url).then(response => response.toJSON()) | |
.then(response => response.data) | |
Q: How can we write a method like the following: | |
sum(2)(4) | |
// returns 6 | |
A: | |
const makeSum = initialSum => value => initialSum + value | |
const makeSum = function(initialSum) { | |
return function (value) { | |
return initialSum + value | |
} | |
} | |
Q: Stateless functional components | |
import Some from './components/Some' | |
const App = () => <div><Some /></div> | |
A: | |
// Some renders some string | |
const App = () => <div><Text content='Some name'>Some name</Text></div> | |
const Text = ({name, children}) => <h1>{children}</h1> | |
// v < 16 | |
render() { | |
return( | |
<div> | |
<Text /> | |
</div> | |
) | |
} | |
// v = 16 | |
render() { | |
return( | |
[ | |
<Text /> | |
<Text /> | |
] | |
) | |
} | |
Q: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment