You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
In many situations, a Hook or Action could be completely stateless (just a bunch of functions), and so the requirement to write such components as classes becomes unnecessary and even counter-intuitive.
If a component is to be shared between multiple possible instances of Atlas in the same process then the component must be written as a class, otherwise it's not clear how to get hold of the correct instance of Atlas class which should be used to handle the request or where to get the reference to other components.
For all other use cases (single-Atlas-instance apps, 95% of normal use cases), one can do the following:
// path to project rootimportatlasfrom'..'// example path to a place where other stateless components existimport{notifier}from'.'// This is a stateless action componentexportdefault{asynccreateAccount(info){// Example how to access other components from this componentconstuser=awaitatlas.services.database.users.insert(info)// Example how to use other stateless componentsawaitnotifier.sendEmail('welcome-message',user.email,user)}}
The text was updated successfully, but these errors were encountered:
In many situations, a
Hook
orAction
could be completely stateless (just a bunch of functions), and so the requirement to write such components as classes becomes unnecessary and even counter-intuitive.If a component is to be shared between multiple possible instances of
Atlas
in the same process then the component must be written as a class, otherwise it's not clear how to get hold of the correct instance ofAtlas
class which should be used to handle the request or where to get the reference to other components.For all other use cases (single-
Atlas
-instance apps, 95% of normal use cases), one can do the following:The text was updated successfully, but these errors were encountered: