Closed Nidilap closed 7 months ago
I was doing it wrong. I managed to do it like this:
const enhance = withObservables(["route"], ({ route }) => ({ batches: watermelonDB.get(TableName.BATCH).query(Q.where("id", route?.params?.idTest)).observe() }));
And in my component:
const TestScreen = ({ route, batches }) => { [...]
Hello.
I am trying to pass props from a screen to an withObservables used to enhance the screen. I am using react navigation, so the data I'm trying to pass comes from it.
This is my screen:
And this is how I'm trying to use withObservables:
Obs.: I'll not use like this, the idea is to use props.idTest as a query to database.get() to filter some models. I am just doing this to test if I can get the props inside the withObservables.
I saw this issue that seems to be the same problem as me: https://github.com/Nozbe/WatermelonDB/issues/1397 However, it is closed. Stophface used recompose to do what I am trying to do, but it is an archived library, so I don't want to use it.
Is there a way to do this within WatermelonDB or using another library that is still maintained?