带参数的函数 React-Native
Function with parameters React-Native
我有这个功能
export default async function get_happy_songs(param) {
let emotion = param;
// console.log(emotion)
...
}
有时我想这样做 :
let arg = value;
let happy_songs = await get_happy_songs(arg);
但我知道函数定义语法有问题,所以我应该如何处理我的函数才能获得该参数?
尝试一下,希望对你有用
export async function get_happy_songs(param) {
let emotion = param;
console.log(emotion)
return true
}
async componentDidMount() {
let happy_songs = await get_happy_songs('Love you like you do');
console.log(happy_songs)
}
我有这个功能
export default async function get_happy_songs(param) {
let emotion = param;
// console.log(emotion)
...
}
有时我想这样做 :
let arg = value;
let happy_songs = await get_happy_songs(arg);
但我知道函数定义语法有问题,所以我应该如何处理我的函数才能获得该参数?
尝试一下,希望对你有用
export async function get_happy_songs(param) {
let emotion = param;
console.log(emotion)
return true
}
async componentDidMount() {
let happy_songs = await get_happy_songs('Love you like you do');
console.log(happy_songs)
}