I want to add something like that require(./assets/
+variable). But require() doesn't support that.
const { sound } = await Audio.Sound.createAsync(
require(`./assets/`+variable)
);
I want to add something like that require(./assets/
+variable). But require() doesn't support that.
const { sound } = await Audio.Sound.createAsync(
require(`./assets/`+variable)
);
require takes a string which is a path to the asset. you can do something like this:
const path = "./assets/" + variable; require(path);
or:
require(./assets/${variable}
);