score:1

import React from "react";
import Module1 from "./Pages/Module1";
import Module2 from "./Pages/Module2";

const components = {
  Module1,
  Module2
};

export default function Module({ match }) {
  const {
    params: { num },
  } = match;

  const MyModule = components["Module"+num]; 

  return (
    <div>
      <MyModule />
    </div>
  );
}

Related Query

More Query from same tag