Last active
April 23, 2022 21:58
-
-
Save rickyalmeidadev/afa659538e1828aa53118fb4a25846b1 to your computer and use it in GitHub Desktop.
Rendering JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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