Skip to content

Instantly share code, notes, and snippets.

@PostPCEra
Created December 12, 2023 09:26
Show Gist options
  • Select an option

  • Save PostPCEra/dc8e416cf48863a88b5fd2971c2acbf9 to your computer and use it in GitHub Desktop.

Select an option

Save PostPCEra/dc8e416cf48863a88b5fd2971c2acbf9 to your computer and use it in GitHub Desktop.
React stand alone
<html>
<head>
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.development.js"></script>
<!---this is used to compile on run time--->
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
</head>
<body>
<h3> React Js Rounded Two Decimal Places</h3>
<div id="app"></div>
<script type="text/babel">
// code source: https://fontawesomeicons.com/tryit/code/react-js-round-two-decimal-places/0
function A2() {
return <h1> OM namo </h1> ;
}
function App() {
const number = 78.94159265359;
const roundedNumber = number.toFixed(2);
return (
<div>
<A2/>
<p>Number: {number}</p>
<p>Rounded Two Decimal Places: {roundedNumber}</p>
</div>
);
}
ReactDOM.render(<App />, document.getElementById('app'));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment