rescript-react-router-dom

    1.0.6 • Public • Published

    Rescript React Router DOM

    Rescript bindings for React Router DOM

    Getting Started

    1. Add this to your package.json:
    npm i rescript-react-router-dom
    
    1. Add this to you bsconfig.json:
    "bs-dependencies": [
        "@rescript/react",
        "rescript-react-router-dom"
    ]
    1. Import into your Rescript project
    open RescriptReactRouterDom.ReactRouterDOM

    Example Usage

    Router

    open RescriptReactRouterDom.ReactRouterDOM
    
    @react.component
    let make = () => {
      <HashRouter>
        <Routes>
          <Route path="/" element={<HomePage />} />
          <Route path="blog" element={<BlogPage />} />
          <Route path="blog/:slug" element={<ArticlePage />} />
          <Route path="about-me" element={<AboutMePage />} />
          <Route path="projects" element={<ProjectsPage />} />
          <Route path="*" element={<Error404Page />} />
        </Routes>
      </HashRouter>
    }

    Links

    open RescriptReactRouterDom.ReactRouterDOM
    
    @react.component
    let make = () => {
      <div>
        <Link className="columns" href={`/blog`}>
          {"Blog" |> React.string}
        </Link>
      </div>
    }
    • Note: to is a reserved word in Rescript. It has been replaced by href in this port.

    Install

    npm i rescript-react-router-dom

    DownloadsWeekly Downloads

    9

    Version

    1.0.6

    License

    MIT

    Unpacked Size

    5.24 kB

    Total Files

    6

    Last publish

    Collaborators

    • benfaerber