I have a constant and I want to use it as a key of another object. However, it does not work. What is the best solution for this?
export const URL_QUERY_PARAMS = Object.freeze({
parentId: "parentId",
groupId: "groupId"
})
const queryParam = { {URL_QUERY_PARAMS.groupId : "test1",
"nodePath" : "test2"}
Use array format to make dynamic key
const queryParam = { "nodePath" : "test2" };
queryParam[URL_QUERY_PARAMS.groupId] = "test1";