File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -4,4 +4,37 @@ description: "Module Functions in ReScript"
44canonical : " /docs/manual/latest/module-functions"
55---
66
7- # Module Functions
7+ # Module Functions
8+
9+ ``` rescript
10+ // next.res - bindings for Next
11+ module type Params = {
12+ type t
13+ }
14+
15+ module MakeNavigation = (Params: Params) => {
16+ @module("next/navigation")
17+ external useNavigation: unit => Params.t = "useNavigation"
18+ }
19+
20+ // Your React component
21+ // component.res
22+ module Params = {
23+ type t = {
24+ tag: string,
25+ item: string,
26+ }
27+ }
28+
29+ module Navigation = Next.MakeNavigation(Params)
30+
31+ @react.component
32+ let make = () => {
33+ let params = Navigation.useNavigation()
34+ <div>
35+ <p> {React.string("Tag: " ++ params.tag)} </p>
36+ <p> {React.string("Item: " ++ params.item)} </p>
37+ </div>
38+ }
39+ ```
40+ import { comma } from " postcss/lib/list"
You can’t perform that action at this time.
0 commit comments