- React Native
When there is a utility function you'd like to use in common during each components, you can do it easily via props by using HOC.
common.js which provides common utility functions has the fault as stateless and inaccessible to react native props.
Solution ( Code )
HOC ( withCommonProps ) provides each component with getLanguageCode and navigateTo function. In each component, you can use the HOC ( withCommonProps ) as below.