Closed ziarno closed 8 years ago
Why is having React components available on the server a bad practice?
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 :)
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.
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.
A components
folder for both sides seems like a good idea. Thanks a lot for your help!
Because
AccountsTemplates.configure
requires access to yourMainLayout
component, in the boilerplate all the components are defined in thelib
directory - seems like bad practice to me. Is there another way? I'm getting a lot ofMainLayout is not defined
messages when I try to play around with it.