Skip to content

Latest commit

 

History

History
41 lines (33 loc) · 1.17 KB

useGlobalize.md

File metadata and controls

41 lines (33 loc) · 1.17 KB

useGlobalize

useGlobalize is a hook which gives access to the Globalize object. You can then destructure any formatters you need within the component.

Example

import { useGlobalize } from 'react-native-globalize';

const ExampleComponent = () => {
  const { formatDate, formatMessage } = useGlobalize();

  return (
    <Text>
      {formatMessage('welcome', {
        date: formatDate(new Date(), { date: 'long' }),
      })}
    </Text>
  )
};

Reference

The following functions and utilities are available on the Globalize object returned by useGlobalize: