I am trying to use a dynamic name for a property of an object.
For example, in the function below, I want to use the value of variable 'catagoryId' to get the child that results into the value for the variable catagoryId. For example if catagoryId = book. I want the last line to resolve to "endAtObject.orderValues.book".
export const feedFetch = (catagoryId, endAtObject) => {
endAtObject.orderValues.<<<catagoryId>>>
}
How do I do this? Any help will be highly appreciated!
endAtObject.orderValues[categoryId]