Skip to content

Instantly share code, notes, and snippets.

@vonwao
Created January 29, 2016 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vonwao/8672a74769e439460685 to your computer and use it in GitHub Desktop.
Save vonwao/8672a74769e439460685 to your computer and use it in GitHub Desktop.
mantra sample
import React from 'react';
import {FlowRouter} from 'meteor/kadira:flow-router';
import {mount} from 'react-mounter';
import MainLayout from '/client/modules/core/components/layout.main.jsx';
import PostList from '/client/modules/core/containers/postlist';
import Post from '/client/modules/core/containers/post';
import NewPost from '/client/modules/core/containers/newpost';
export default function (injectDeps) {
const MainLayoutCtx = injectDeps(MainLayout);
// Move these as a module and call this from a main file
FlowRouter.route('/', {
name: 'posts.list',
action() {
mount(MainLayoutCtx, {
content: () => (<PostList />)
});
}
});
FlowRouter.route('/post/:postId', {
name: 'posts.single',
action({postId}) {
mount(MainLayoutCtx, {
content: () => (<Post postId={postId}/>)
});
}
});
FlowRouter.route('/new-post', {
name: 'newpost',
action() {
mount(MainLayoutCtx, {
content: () => (<NewPost/>)
});
}
});
FlowRouter.route('/ex1', {
name: 'newpost',
action() {
mount(MainLayoutCtx, {
content: () => (<NewPost/>)
});
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment