Skip to content

Instantly share code, notes, and snippets.

@smoralb
Last active January 11, 2022 22:13
Show Gist options
  • Save smoralb/4b687ce11e2616ad1cfd2b9cdc03770c to your computer and use it in GitHub Desktop.
Save smoralb/4b687ce11e2616ad1cfd2b9cdc03770c to your computer and use it in GitHub Desktop.
import './App.css'
import SectionItem from './components/section-item/sectionItem'
import { useTranslation } from 'react-i18next'
import React from 'react'
export default function App () {
const { t } = useTranslation()
var section = t('section', { returnObjects: true }) // Return the array from my local JSON file
return (
<div className='App'>
{section &&
section.length > 0 &&
section.map(item => {
return (
<React.Fragment key={item.title}>
<SectionItem item={item} />
</React.Fragment>
)
})}
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment