0

It's third day of research and I can't find simple solution. The thing is that I want to create dynamic reactjs page. For example "example.com/project/10" generates 10th project from mongodb. It seems pretty simple, however I don't know why it is so complicated to achieve using react.

Thanks for help

1 Answer 1

1

Assuming you are using React Router -

<Route path='project/:project_id' component={Project} />

class Project extends Component {
  ...
  componentDidMount () {
    const { project_id } = this.props.match.params;
    fetch_project_from_db(project_id);
  }
  ...
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.