How can I call const variable in same file but outside export const
export const getData = async ({page="1",limit="10", createdAt="}) => {
}
I want to crate variable like this
const params = {
page = "1",
limit = "10",
createdAt="",
}
and In export I want to call some thing like this
export const getData = async (params) => {
}
the reason that I want to do like this because I want to make my code more easy to read thanks
By using a self invoking function that return a closure:
const getData = ((params) => {
return async () =>{
console.log(params)
}
})({foo:'bar'})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.