0

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)
  
);

1 Answers1

-1

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});