H is undefined
garethworld opened this issue · comments
I am trying to reference my Highway instance in a renderer, but I get the error: uncaught (in promise) ReferenceError: H is not define
Any ideas why?
Main js
import Highway from '@dogstudio/highway';
import Fade from './fade.js';
import home from './home.js';
const H = new Highway.Core({
transitions: {
default: Fade
},
renderers: {
home: home
}
});
Home
import Highway from '@dogstudio/highway';
class home extends Highway.Renderer {
onEnter() {
H.redirect('/your-lanterns');
}
}
export default home;
Hello, you'll want to export const H
from main.js and import H into the home renderer for that to work. However what you're doing is better handled with a 301 redirect placed in the .htaccess file, not handled client side in javascript.