You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recommended is the use of .NET 8. You can check your local .NET version with `dotnet --version` and update your .fsproj files with
21
21
22
-
```bash
23
-
# cmd
24
-
dotnet --version
22
+
```xml
23
+
<TargetFramework>net8.0</TargetFramework>
25
24
```
26
25
27
26
## React.memo
28
27
29
-
React.memo is used to meoize the rendering of your components and prevent unnecessary rerenders. The recommended usecase is the attribute [<ReactMemoComponent>] but you can also use [React.memo](https://fable-hub.github.io/Feliz/next/api-docs/react/apis/memo)to define a component for memo. When doing so, the component of React.lazy' must be bind with let and be called with React.lazyRender to render it.
28
+
`React.memo` behavior was reworked to improve compatibility with React devtools. It now **requires** to be called with `React.memoRenderer`. Check out the [docs](./api-docs/react/apis/memo) for more info and alternatives!
React.lazy' is used to call components dynamically, also only when needed, in order to reduce the required performance. The recommended usecase is the attribute [<ReactLazyComponent>] but you can also define a lazy loaded comonent using [React.lazy'](https://fable-hub.github.io/Feliz/next/api-docs/react/apis/lazy). When doing so, the component of React.lazy' must be bind with let and be called with React.lazyRender to render it.
45
+
`React.lazy'` behavior was reworked. It now **requires**to be called with `React.lazyRenderer`. Check out the [docs](./api-docs/react/apis/lazy) for more info and alternatives!
74
46
75
47
```fsharp
76
-
open Feliz
77
-
open Fable.Core
78
-
79
-
/// Lazy load with delay to simulate large component
80
-
///
81
-
/// Note: Prefer using `[<ReactLazyComponent>]` instead of this approach!
82
48
let LazyHello: LazyComponent<unit> =
83
49
React.lazy'(fun () ->
84
50
promise {
@@ -87,91 +53,60 @@ let LazyHello: LazyComponent<unit> =
87
53
}
88
54
)
89
55
90
-
[<ReactComponent(true)>]
56
+
[<ReactComponent>]
91
57
let SuspenseDemo() =
92
-
let load, setLoad = React.useState(false)
93
58
Html.div [
94
-
Html.h3 [ prop.text "Suspense Example" ]
95
-
Html.p "Loading the component will take 2 seconds. Then the component will be cached and future reruns will be instant."
React.createContext enables the user to create a context for a component in react. That way, values are shared automatically between a component and all its children, without inserting them. In order to use [React.createContext](https://fable-hub.github.io/Feliz/next/api-docs/react/apis/createContext), you must define a reactcontext with a let binding. Then you can call that context in a provider, which inserts the values to be shared in the defined context.Provider and the child components.
69
+
Using context with React was reworked to more closely align with React functionality.
113
70
114
71
```fsharp
115
-
open Feliz
116
-
open Browser.Dom
117
-
118
-
open Feliz
119
-
120
72
// Define a context for shared state
121
73
// This can should be placed in a separate file for reuse
122
74
let CounterContext = React.createContext(None: (int * (int -> unit)) option)
123
75
124
-
[<ReactComponent>]
125
-
let CounterProvider(children: ReactElement list) =
0 commit comments