-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
```js | ||
import { TestProvider } from "@hiogawa/test-deps-test1/provider" | ||
import { TestProvider } from "@hiogawa/test-deps-test1" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exports.test = "[ok]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
"use client" | ||
|
||
import React from "react"; | ||
import dep from "./client-dep.cjs"; | ||
|
||
export function TestClient() { | ||
return React.createElement("span", null, `[TestClient: ${dep.test}]`) | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/react-server/examples/basic/deps/cjs/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "@hiogawa/test-deps-cjs", | ||
"private": true, | ||
"type": "module", | ||
"exports": { | ||
".": "./server.js" | ||
}, | ||
"dependencies": { | ||
"react": "*" | ||
}, | ||
"peerDependencies": { | ||
"react": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from "react"; | ||
|
||
export function TestServer() { | ||
// return | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/react-server/examples/basic/deps/context/client.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"use client" | ||
|
||
import React from "react"; | ||
|
||
const MyContext = React.createContext("not-ok"); | ||
|
||
export function MyContextProvider(props) { | ||
return React.createElement(MyContext.Provider, { value: "ok" }, props.children) | ||
} | ||
|
||
// consume own context in client entry | ||
export function TestClient() { | ||
const value = React.useContext(MyContext); | ||
return React.createElement("span", null, `[context: ${value}]`) | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/react-server/examples/basic/deps/context/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "@hiogawa/test-deps-context", | ||
"private": true, | ||
"type": "module", | ||
"exports": { | ||
"./server": "./server.js", | ||
"./client": "./client.js" | ||
}, | ||
"dependencies": { | ||
"react": "*" | ||
}, | ||
"peerDependencies": { | ||
"react": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from "react"; | ||
import { MyContextProvider } from "@hiogawa/test-deps-context/client" | ||
|
||
// consume own provider in server entr | ||
export function TestServer(props) { | ||
return React.createElement(MyContextProvider, null, props.children) | ||
} |