1

I know how to connect my translate function to a component this way:

class App extends Component {
...
}
export default translate('common')(App);

But how can I do the same task if component is being exported this way:

export function UserInterface({data, onAdmin, isAdmin}: propTypes){
...

I know, that this is kind of silly question. But I am stuck at this point.

2 Answers 2

1

You can write something like this:

export const UserInterfaceWithTranslation = translate('common')(UserInterface);

Please read more about exports.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! It really helped!
1

You can export functions too

MyContext.js

function UserInterface({data, onAdmin, isAdmin}: propTypes){ 
 ... some code
}

module.exports = {
 userInterface : UserInterface
}

Import

import myContexts from './MyContext'

myContexts.userInterface(params);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.