screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <script src="https://unpkg.com/react@17.0.2/umd/react.development.js"></script> <script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js"></script> <script src="https://cdn.jsdelivr.net/npm/@babel/standalone@7.14.6/babel.min.js"></script> </head> <body> <div id="app"></div> <script type="text/babel" data-presets="env,react"> const { useState } = React; function App() { const [testObj, setTestObj] = useState({ firstName: "David", lastName: "Warner", role: "Opener", }); return ( <div className='container'> <h2>React Js Convert JSON to string | JSON.stringify()</h2> <p>String: {JSON.stringify(testObj)}</p> </div> ); } ReactDOM.render(<App />, document.getElementById("app")); </script> </body> </html>