Skip to content

Commit

Permalink
passing id in prop to schematic editor
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitgeddam committed Jun 6, 2020
1 parent d6c2bfa commit 65cc7fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions eda-frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,14 @@ function PublicRoute ({ component: Component, restricted, nav, ...rest }) {

function SchematicEditorRoute (props) {
useEffect(() => {
console.log(props.match.params.Id)

}, [props])

return <Redirect to='/editor' />
return <Redirect to={{
pathname: '/editor',
state: {id:props.match.params.Id}

}} />
}

function App () {
Expand Down
8 changes: 7 additions & 1 deletion eda-frontend/src/pages/SchematiEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const useStyles = makeStyles((theme) => ({
}
}))

export default function SchematiEditor () {
export default function SchematiEditor (props) {
const classes = useStyles()
const compRef = React.createRef()
const gridRef = React.createRef()
Expand All @@ -43,6 +43,12 @@ export default function SchematiEditor () {
var container = gridRef.current
var sidebar = compRef.current
var outline = outlineRef.current

if(props.location.state.id){
console.log("id",props.location.state.id)
}


LoadGrid(container, sidebar, outline)
}, [compRef, gridRef, outlineRef])

Expand Down

0 comments on commit 65cc7fb

Please sign in to comment.