Flow architecture - root container, rendering and passing params


#1

From flow components guidelines we should design with root component in mind, which in turn should manage routing and coordinate communication with child components.

  1. What is/how do you create root component? Would this be an example of it?

    {{ > render component=root }}

here is definition of root component

<template name="root">
	{{ > render component=header }}
	{{ > render component=shoppingCart }}
	{{ > render component=footer }}
</template>

and then I’d call it from /lib/router.js like this

FlowRouter.route("/", {
	action : function (params) {
		FlowLayout.render("layout", { root: "root"});
	}
});

and this should properly render my componentized layout.

  1. How would I pass initial state to the root component? For example I would want to hide one of the child components and probably the easiest way to do it would be to set the state via URL.

  2. How do I control routing from a root component?