Skip to content

Instantly share code, notes, and snippets.

@rickyalmeidadev
Last active April 23, 2022 21:58
Show Gist options
  • Save rickyalmeidadev/afa659538e1828aa53118fb4a25846b1 to your computer and use it in GitHub Desktop.
Save rickyalmeidadev/afa659538e1828aa53118fb4a25846b1 to your computer and use it in GitHub Desktop.
Rendering JSON
import React, { useEffect, useState } from 'react'
import axios from 'axios'
import Debugger from './Debugger'
function App() {
const [json, setJson] = useState(null)
useEffect(() => {
axios.get('url').then(response => {
setJson(response.data)
})
}, [])
return <Debugger json={json} />
}
export default App
import React from 'react'
import { Text, View } from 'react-native'
function Debugger({ json }) {
return (
<View>
<Text>{JSON.stringify(json, null, 2)}</Text>
</View>
)
}
export default Debugger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment