meteor-useraccounts / flow-routing

Useraccounts packages add-on for integration with Flow Router and Blaze Layout.
https://atmospherejs.com/useraccounts/flow-routing
MIT License
72 stars 50 forks source link

For working with React, do I have to put my components in the lib directory? #30

Closed ziarno closed 8 years ago

ziarno commented 8 years ago

Because AccountsTemplates.configure requires access to your MainLayout component, in the boilerplate all the components are defined in the lib directory - seems like bad practice to me. Is there another way? I'm getting a lot of MainLayout is not defined messages when I try to play around with it.

jshimko commented 8 years ago

Why is having React components available on the server a bad practice?

ziarno commented 8 years ago

Wow, Thanks for the fast response!

Isn't it? It's my first Meteor app really, but all the tutorials I've seen put the react components in the client dir. The lib dir is just for routes :)

jshimko commented 8 years ago

You don't have to put your React components in a lib folder if you don't want to. That's just an example. However, you do have to have your React components defined on both client and server for the AccountsTemplates.configure() to work with React. Considering React can do server side rendering, I don't see any reason why that should be an issue. React, it's the New Way. (up until it isn't anymore) :)

Placing UI components in the client folder was the standard practice previously because Blaze is only available to you on the client. Not the case with React. I only used the lib folder because it's a common place to put code that runs on both client and server.

jshimko commented 8 years ago

You could just as easily place your components in a components folder and accomplish the same thing. Just needs to not be restricted to the client.

ziarno commented 8 years ago

A components folder for both sides seems like a good idea. Thanks a lot for your help!