Skip to content

How to access locally scoped data from CompositionLocal in component #833

Answered by arkivanov
leononame asked this question in Q&A
Discussion options

You must be logged in to vote

Currently, the database connection is created dynamically inside a Composable function

I might be missing context, but this doesn't look like a good approach. You can create the database one of your component and pass it down to every child component, or have one single instance in the application, depending on the use case.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@leononame
Comment options

Comment options

You must be logged in to vote
3 replies
@leononame
Comment options

@arkivanov
Comment options

@leononame
Comment options

Answer selected by leononame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants