with-i18n.tsx 404 B

1234567891011121314151617181920
  1. 'use client'
  2. import type { ReactNode } from 'react'
  3. import { useContext } from 'use-context-selector'
  4. import I18NContext from '@/context/i18n'
  5. export type II18NHocProps = {
  6. children: ReactNode
  7. }
  8. const withI18N = (Component: any) => {
  9. return (props: any) => {
  10. const { i18n } = useContext(I18NContext)
  11. return (
  12. <Component {...props} i18n={i18n} />
  13. )
  14. }
  15. }
  16. export default withI18N