Here is the golden question, imagine we have a file based routing solution and we want state. Say to pass down the database connection, or some auth guards to avoid the ../../...
hell. Whatever it is it needs to be easy to use and type safe
Say we have this:
import Router from 'packge';
const router = new Router('src/routes');
We can do whatever to Router class to support props, but how do we have them in the files?
src/routes/test.js
export const test = () => {
const db = ... ?
}
How do we pass db down to test in a type safe and simple way?
It's not just about database, it's about any props. The example is just db as that will be the most common prop passed down