These all have a function that just assigns a default context when createTrinity already does that
|
(_context: Z = context, app?: App): Z => provideContext(_context, app), |
export function createMyFeature<E extends MyContext = MyContext>() {
const [useContext, _provideContext] = createContext<E>('my-context')
const context = { foo: 'hello', bar: 42 }
function provideContext (_context: E = context, app?: App): E {
return _provideContext(_context, app)
}
return createTrinity<E>(useContext, provideContext, context)
}
Instead of just
export function createMyFeature() {
const [useContext, provideContext] = createContext<MyContext>('my-context')
const context = { foo: 'hello', bar: 42 }
return createTrinity<MyContext>(useContext, provideContext, context)
}
useContext and provideContext are only ever passed directly to createTrinity too, why not just
export function createMyFeature() {
const context = { foo: 'hello', bar: 42 }
return createTrinity<MyContext>('my-context', context)
}
These all have a function that just assigns a default context when createTrinity already does that
0/packages/0/src/composables/createTrinity/index.ts
Line 69 in c903787
Instead of just
useContext and provideContext are only ever passed directly to createTrinity too, why not just