diff --git a/docs/FAQ/ComponentNotRerendering.md b/docs/FAQ/ComponentNotRerendering.md new file mode 100644 index 0000000..3afaa62 --- /dev/null +++ b/docs/FAQ/ComponentNotRerendering.md @@ -0,0 +1,16 @@ +### Question + +My component is not rerendering, what should I do? + +### Answer + +This could happen for a few reasons. Try the following: + +1. Make sure you are using a `reagent.core/atom` (i.e., ratom) instead of a normal `atom`. +2. Make sure to deref your ratom (e.g, @app-state) inside of your component. +3. Make sure your ratom will survive a rerender. Either declare it as a global var, or use a form-2 component. [Read this](https://github.com/reagent-project/reagent-cookbook/tree/master/basics/component-level-state) if you want to understand why. +4. Make sure to deref your ratom outside of a seq or wrap that seq in a `doall`. See this [related issue](https://github.com/reagent-project/reagent/issues/18). + +*** + +Up: [FAQ Index](README.md)       diff --git a/docs/README.md b/docs/README.md index 882b7ee..28ff620 100644 --- a/docs/README.md +++ b/docs/README.md @@ -18,11 +18,12 @@ Also: ## Frequently Asked Questions 1. [How do I use React's "refs"](FAQ/UsingRefs.md) -1. [How can I use an entity like "nbsp"?](FAQ/UsingAnEntity.md) -2. [Why is my attribute (like autoFocus) missing?](FAQ/MyAttributesAreMissing.md) -3. [How can I use React's dangerouslySetInnerHTML?](FAQ/dangerouslySetInnerHTML.md) -3. [How do I force Component re-creation?](https://groups.google.com/forum/#!topic/reagent-project/tNY4gzk7TUY) (external link) -4. [How do I access "props" in lifecycle methods?](http://nils-blum-oeste.net/clojurescripts-reagent-using-props-in-lifecycle-hooks/) (external link) +2. [How can I use an entity like "nbsp"?](FAQ/UsingAnEntity.md) +3. [Why is my attribute (like autoFocus) missing?](FAQ/MyAttributesAreMissing.md) +4. [How can I use React's dangerouslySetInnerHTML?](FAQ/dangerouslySetInnerHTML.md) +5. [How do I force Component re-creation?](https://groups.google.com/forum/#!topic/reagent-project/tNY4gzk7TUY) (external link) +6. [How do I access "props" in lifecycle methods?](http://nils-blum-oeste.net/clojurescripts-reagent-using-props-in-lifecycle-hooks/) (external link) +7. [My component is not rerendering, what should I do?](FAQ/ComponentNotRerendering.md) ## Commercial Videos Series