swipely / aviator

Aviator is a single-page front-end router built for modularity.
MIT License
143 stars 6 forks source link

Import statement in docs #83

Open analubarreto opened 3 years ago

analubarreto commented 3 years ago

I'm pretty sure I should import something from somewhere before using Aviator.setRoutes, but you don't seem to have put it in the docs!

ls-andrew-borstein commented 3 years ago

@analubarreto you're right — anytime you want to use a method like Aviator.setRoutes or Aviator.navigate you should import it first, like

import Aviator from 'aviator';
import CampaignsTarget from 'route_targets/campaigns_target'

Aviator.setRoutes({
  '/campaigns': {
    target: CampaignsTarget,
    '/': 'index',
    '/add': 'add'
  }
});

Hope this helps!