Simplify example code even more in README.md
This commit is contained in:
parent
6349f5388a
commit
27156a56a9
|
@ -29,14 +29,8 @@ import TokamakDOM
|
|||
|
||||
public struct Counter: View {
|
||||
@State public var count: Int
|
||||
|
||||
let limit: Int
|
||||
|
||||
public init(_ count: Int, limit: Int = Int.max) {
|
||||
_count = .init(wrappedValue: count)
|
||||
self.limit = limit
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
count < limit ?
|
||||
AnyView(
|
||||
|
@ -62,7 +56,7 @@ import TokamakDOM
|
|||
let document = JSObjectRef.global.document.object!
|
||||
|
||||
let divElement = document.createElement!("div").object!
|
||||
let renderer = DOMRenderer(Counter(5), divElement)
|
||||
let renderer = DOMRenderer(Counter(count: 5, limit: 15), divElement)
|
||||
|
||||
let body = document.body.object!
|
||||
_ = body.appendChild!(divElement)
|
||||
|
|
Loading…
Reference in New Issue