import { h , Context } from 'preact' ; import crayon from 'crayon' ; export const withContext = < T = any > ( context , contextState ) => { const options = { value : contextState , children : undefined } ; const Context = ( Component ) => ( ) => h ( context . Provider , options , h ( Component , null ) ) ; return ( ctx ) => { const _mount = ctx . mount ; ctx . mount = ( Component ) => _mount ( Context ( Component ) ) ; } ; } ;