As you all know Next JS doesn't have any route, I am trying to build a web app in next JS in which I have to use the same component for multiple routes without copy pasting in to different directory.
Directroy structure:
src
pages
new (AddListComponent)
edit-[id] (AddListComponent)
AddListComponent
import React from 'react'
import { withRouter } from 'next/router'
class Listing extends React.Component {
constructor(props){
super(props)
this.state = {
}
}
render () {
return (
<div>This is my new component</div>
)
}
}
export default withRouter(Listing)