Feat: fix docs names

This commit is contained in:
Jonathan Kelley committed 2021-02-08 11:12:02 -05:00
1 parent edbb33b2ee
commit ee23ea6c3a
13 files changed
+39 -14

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
# Hello, World!
Dioxus should look and feel just like writing functional React components. In Dioxus, there are no class components with lifecycles. All state management is done via hooks. This encourages logic resusability and lessens the burden on Dioxus to maintain a non-breaking lifecycle API.
```rust
#[derive(Properties, PartialEq)]
struct MyProps {
name: String
}
fn Example(ctx: Context<MyProps>) -> VNode {
html! { <div> "Hello {ctx.props().name}!" </div> }
}
```
For functions to be valid components, they must take the `Context` object which is generic over some properties. The properties parameter must implement the `Properties` trait, which can be automatically derived. Whenever the input properties of a component changes, the function component will be re-ran and a new set of VNodes will be generated.