I would like to change my export { default } from 'MyFile'
depending on certain conditions, so can I replace the file with a string variable?
Currently I have something like this:
let exportFrom
if(SOME_CONDITION) {
exportFrom = '../Something/Blah'
} else {
exportFrom = './SomethingElse'
}
export { default } from exportFrom
This currently doesn't work as I get:
Parsing error: Unexpected token
Is there a way to do this?
It is also important to note, that the reason I am doing this in the first place is because I am using nextjs, and one of my pages needs to be an error in certain conditions, otherwise it is just a react component which handles the content of it. So if this is not the way to do it, how do I solve my issue?