score:-1

i'm not sure you are using hoc in the right way, ref (https://reactjs.org/docs/higher-order-components.html)

in hoc, you pass a component in and the hoc provides additional props and/or rendered components:

const withlocale = (component, locale, ...otherprops) => {
    if (!locale) {
        return <error statuscode={404} />
    }
    return (
        <localeprovider lang={locale}>
            <component {...otherprops} />
        </localeprovider>
    )
}

const wrappedpage = ({prop1, prop2}) => <h1>{prop1 + ' ' + prop2}</h1>

export default withlocale(wrappedpage, locale, prop1, prop2 etc)

Related Query

More Query from same tag