Comments (2)
What does component()
do?
Calls your function inside component_scope
sycamore/packages/sycamore/src/builder.rs
Lines 882 to 887 in fedc881
What does component_scope()
do?
sycamore/packages/sycamore-core/src/component.rs
Lines 19 to 28 in fedc881
Calls your component within untrack()
.
Why does it do this? This prevents a signal read inside your component body from subscribing itself to an effect outside your component body, which would cause the entire component to rerender every time that signal changed.
This is very common in fine-grained reactive libraries. Much like not wearing a seat belt, omitting component(|| ...)
won't cause you any issues until it does, and then you'll wish you'd just always done it.
from sycamore.
Gotcha, thanks!
BTW I've decided to use the builder version for projects, in order to take advantage of cargo fmt, and more linting.
Except for one page, the docs only show the view! macro version, so I'm having to guess and find things manually.
Should I open up an issue for that one?
from sycamore.
Related Issues (20)
- Use-after-free with create_effect HOT 9
- Empty false condition for builder `dyn_if`
- Builder pattern `button().on(ev::click...)` fails: undeclared crate or module. HOT 3
- Builder version `input().bind_value(...)` has requirements that the `view! ` macro doesn't HOT 3
- Documentation recommends deprecated `weealloc` HOT 1
- Example of mutating a collection HOT 3
- <form> element cause whole app to refresh HOT 1
- Docs website navigation improvements
- view! failing when attribute name ends in `-ref` HOT 1
- Invalid HTML from view! HOT 6
- Optional attributes in view!
- Abstract over reactiveness HOT 1
- SVG with interpolation doesn't render in browser HOT 2
- use_context Error after updating to 0.9.0-beta.2 HOT 4
- Probable bug in signal propagation HOT 4
- Panic updating signal in 0.9.0-beta.2
- Bootstrap scrollspy support HOT 4
- Book (website) routing not properly updating HOT 8
- Shared data update failed when nested routing layout HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sycamore.