Small updates
This commit is contained in:
parent
b9ad15af2e
commit
50e2658b27
19
chapter02/src/tagged_templates.js
Normal file
19
chapter02/src/tagged_templates.js
Normal file
@ -0,0 +1,19 @@
|
||||
function showAge(strings, name, year) {
|
||||
const currYear = new Date().getFullYear();
|
||||
const yearsAgo = currYear - year;
|
||||
return (
|
||||
strings[0] + name + strings[1] + year + `, ${yearsAgo} years ago`
|
||||
);
|
||||
}
|
||||
|
||||
const who = "Prince Valiant";
|
||||
const when = 1937;
|
||||
const output1 = showAge`The ${who} character was created in ${when}.`;
|
||||
console.log(output1);
|
||||
// The Prince Valiant character was created in 1937, 81 years ago
|
||||
|
||||
const model = "Suzuki";
|
||||
const yearBought = 2009;
|
||||
const output2 = showAge`My ${model} car was bought in ${yearBought}`;
|
||||
console.log(output2);
|
||||
// My Suzuki car was bought in 2009, 9 years ago
|
||||
1155
chapter12/package-lock.json
generated
1155
chapter12/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -7,25 +7,25 @@
|
||||
"@storybook/addon-links": "^3.4.11",
|
||||
"@storybook/cli": "^3.4.11",
|
||||
"@storybook/react-native": "^3.4.11",
|
||||
"enzyme": "^3.6.0",
|
||||
"enzyme-adapter-react-16": "^1.5.0",
|
||||
"eslint": "^5.6.0",
|
||||
"eslint-config-recommended": "^3.0.0",
|
||||
"eslint-plugin-babel": "^5.2.0",
|
||||
"eslint-plugin-flowtype": "^2.50.1",
|
||||
"enzyme": "^3.7.0",
|
||||
"enzyme-adapter-react-16": "^1.7.0",
|
||||
"eslint": "^5.9.0",
|
||||
"eslint-config-recommended": "^3.0.2",
|
||||
"eslint-plugin-babel": "^5.3.0",
|
||||
"eslint-plugin-flowtype": "^2.50.3",
|
||||
"eslint-plugin-react": "^7.11.1",
|
||||
"eslint-plugin-react-native": "^3.3.0",
|
||||
"eslint-plugin-react-native": "^3.5.0",
|
||||
"flow": "^0.2.3",
|
||||
"flow-bin": "^0.81.0",
|
||||
"flow-coverage-report": "^0.6.0",
|
||||
"flow-typed": "^2.5.1",
|
||||
"jest-expo": "~27.0.0",
|
||||
"prettier": "^1.14.3",
|
||||
"prettier": "^1.15.2",
|
||||
"react-addons-test-utils": "^15.6.2",
|
||||
"react-devtools": "^3.4.0",
|
||||
"react-devtools": "^3.4.3",
|
||||
"react-native-scripts": "1.14.0",
|
||||
"react-native-storybook-loader": "^1.8.0",
|
||||
"react-test-renderer": "^16.5.2",
|
||||
"react-test-renderer": "^16.6.3",
|
||||
"reactotron-react-native": "^2.1.0",
|
||||
"reactotron-redux": "^2.1.0",
|
||||
"redux-devtools-extension": "^2.13.5"
|
||||
@ -59,11 +59,11 @@
|
||||
"axios": "^0.18.0",
|
||||
"expo": "^27.0.1",
|
||||
"prop-types": "^15.6.2",
|
||||
"react": "^16.5.2",
|
||||
"react-dom": "^16.5.2",
|
||||
"react": "^16.6.3",
|
||||
"react-dom": "^16.6.3",
|
||||
"react-native": "~0.55.2",
|
||||
"react-navigation": "^2.16.0",
|
||||
"react-redux": "^5.0.7",
|
||||
"react-navigation": "^2.18.2",
|
||||
"react-redux": "^5.1.1",
|
||||
"redux-mock-store": "^1.5.3",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"whatwg-fetch": "^2.0.4"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user