Skip to content

Commit

Permalink
API for code samples
Browse files Browse the repository at this point in the history
  • Loading branch information
henilp105 committed Sep 24, 2022
1 parent ee6f9f5 commit a2edc29
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ function App() {
const [stdlibOn, setstdlibOn] = useState(false); // state to store package info
const [exercise, setExercise] = useState(0) // Tutorial Exercise
const [showTutorial, setshowTutorial] = useState(false)
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);

// Handle tutorial buttons
const goRight = () => {
Expand Down Expand Up @@ -109,9 +111,13 @@ const tutfunc = (TutorialCode) =>{
setText("")
}

const loadCode = () => {
setText(urlParams.get('code'))
}


return (
<div className="App">
<div className="App" onLoad={loadCode}>
{/*Navbar*/}
<div style={{paddingBottom: "0.5rem"}}><Navigationbar/></div>
<div className='code-wrapper'>
Expand Down

0 comments on commit a2edc29

Please sign in to comment.