-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add counter to show fast-refresh is working (#15)
- Loading branch information
Showing
2 changed files
with
20 additions
and
10 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
packages: | ||
- "rspack/*" | ||
- "rspack/**" | ||
- "rsbuild/*" | ||
- "rspress/*" | ||
- "modernjs/*" |
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 |
---|---|---|
@@ -1,17 +1,27 @@ | ||
import { formatRelative, subDays } from "date-fns"; | ||
import { useEffect, useState } from "react"; | ||
// date-fns is a shared module, but used as usual | ||
// exposing modules act as async boundary, | ||
// so no additional async boundary need to be added here | ||
// As data-fns is an shared module, it will be placed in a separate file | ||
// It will be loaded in parallel to the code of this module | ||
|
||
const Component = ({ locale }) => ( | ||
<div style={{ border: "5px solid darkblue" }}> | ||
<p>I'm a Component exposed from container B!</p> | ||
<p> | ||
Using date-fn in Remote:{" "} | ||
{formatRelative(subDays(new Date(), 2), new Date(), { locale })} | ||
</p> | ||
</div> | ||
); | ||
const Component = ({ locale }) => { | ||
let [cnt, setCnt] = useState(0); | ||
useEffect(() => { | ||
setInterval(() => { | ||
setCnt(x => x+1); | ||
}, 1000) | ||
},[]) | ||
return ( | ||
<div style={{ border: "5px solid darkblue" }}> | ||
<div>cnt: {cnt}</div> | ||
<p>I'm a Component exposed from container B!</p> | ||
<p> | ||
Using date-fn in Remote:{" "} | ||
{formatRelative(subDays(new Date(), 2), new Date(), { locale })} | ||
</p> | ||
</div> | ||
); | ||
}; | ||
export default Component; |