Closed rjpruitt16 closed 6 years ago
Below codes will same as comment.
import fp from 'lodash/fp';
// import _ from 'lodash';
const resume = fp.get('markdownRemark')(data);
// const resume = _.get(data, 'markdownRemark');
// it can also be, const resume = fp.get('markdownRemark', data);
And I recommend two pages to read.
and about lodash.
_
and fp
are different. fp
is wrapped and it can help user to curry easily.
You can refer this page.
https://github.com/lodash/lodash/wiki/FP-Guide
FYI. it explains what is currying
/* not curried function */
function sumOfThreeThings(x, y, z) {
return x + y + z;
}
sumOfThreeThings(1, 2, 3); // 6
/* curried function */
const sumOfThreeThings = x =>
y =>
z =>
x + y + z;
sumOfThreeThings(1)(2)(3); // 6
I am trying to manipulate code to create a interest page for myself. I am not sure lodash/fp "get" is doing here. When I look at the docs https://lodash.com/docs/4.17.10#get, it specifically states the get function takes two arguments. You the get function in store/app/selectors.js and components/resume/index.jsx like this. What are you storing in these variables using the get function, and how are you only using one argument.