mirror of https://github.com/status-im/reagent.git
remove README from inside of FAQs and point back to docs README instead;
This commit is contained in:
parent
d87b3dd2f1
commit
96d263a4f1
|
@ -13,4 +13,4 @@ This could happen for a few reasons. Try the following:
|
|||
|
||||
***
|
||||
|
||||
Up: [FAQ Index](README.md)
|
||||
Up: [FAQ Index](../README.md)
|
||||
|
|
|
@ -14,4 +14,4 @@ you use `col-span` instead of React's `colSpan`.
|
|||
|
||||
***
|
||||
|
||||
Up: [FAQ Index](README.md)
|
||||
Up: [FAQ Index](../README.md)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
|
||||
|
||||
## Want To Add An FAQ?
|
||||
|
||||
Many Thanks!! We'd like that:
|
||||
1. As a base, just use the structure from one of the existing FAQs files
|
||||
2. Give us a PR which includes your new file AND a change to this README so your entry is listed.
|
|
@ -30,4 +30,4 @@ in `nodejs` the DOM is unlikely to be available (unless you try using
|
|||
|
||||
***
|
||||
|
||||
Up: [FAQ Index](README.md)
|
||||
Up: [FAQ Index](../README.md)
|
||||
|
|
|
@ -10,26 +10,26 @@ We'll start with a code fragment, because it is worth a 1000 words:
|
|||
|
||||
```cljs
|
||||
(defn video-ui []
|
||||
(let [!video (clojure.core/atom nil)] ;; stores the
|
||||
(fn [{:keys [src]}]
|
||||
[:div
|
||||
[:div
|
||||
[:video {:src src
|
||||
:style {:width 400}
|
||||
:ref (fn [el]
|
||||
(reset! !video el))}]]
|
||||
[:div
|
||||
[:button {:on-click (fn []
|
||||
(when-let [video @!video] ;; not nil?
|
||||
(if (.-paused video)
|
||||
(.play video)
|
||||
(.pause video))))}
|
||||
"Toogle"]]])))
|
||||
(let [!video (clojure.core/atom nil)] ;; stores the
|
||||
(fn [{:keys [src]}]
|
||||
[:div
|
||||
[:div
|
||||
[:video {:src src
|
||||
:style {:width 400}
|
||||
:ref (fn [el]
|
||||
(reset! !video el))}]]
|
||||
[:div
|
||||
[:button {:on-click (fn []
|
||||
(when-let [video @!video] ;; not nil?
|
||||
(if (.-paused video)
|
||||
(.play video)
|
||||
(.pause video))))}
|
||||
"Toogle"]]])))
|
||||
```
|
||||
|
||||
Notes:
|
||||
Notes:
|
||||
1. That's a Form-2 component. That allows us to retain state outside of the renderer `fn`.
|
||||
2. We capture state in `!video`. The state we capture is a reference to a video component.
|
||||
2. We capture state in `!video`. The state we capture is a reference to a video component.
|
||||
2. `!video` is a `clojure.core/atom` and not a `reaagent.core/atom`
|
||||
4. On the `:video` component there's a `:ref` callback function which establishes the state in `!video`
|
||||
5. Thereafter, `@!video` is used with the `:button's` `:on-click` to manipulate the `video`
|
||||
|
|
|
@ -14,4 +14,4 @@ A minimal (contrived example):
|
|||
|
||||
***
|
||||
|
||||
Up: [FAQ Index](README.md)
|
||||
Up: [FAQ Index](../README.md)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
## Tutorials
|
||||
|
||||
1. [Using Hiccup to Describe HTML](/docs/UsingHiccupToDescribeHTML.md)
|
||||
|
@ -14,7 +13,7 @@ Also:
|
|||
* [Reagent Deep Dive Series by Timothy Pratley](http://timothypratley.blogspot.com.au/p/p.html) - a four part series
|
||||
* [Props, Children & Component Lifecycle](https://www.martinklepsch.org/posts/props-children-and-component-lifecycle-in-reagent.html) by Martin Klepsch
|
||||
* [Using Stateful JS Components - like D3](https://github.com/Day8/re-frame/blob/master/docs/Using-Stateful-JS-Components.md) (external link)
|
||||
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
1. [How do I use React's "refs"](FAQ/UsingRefs.md)
|
||||
|
@ -25,6 +24,13 @@ Also:
|
|||
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)
|
||||
|
||||
### Want To Add An FAQ?
|
||||
|
||||
Many Thanks!! We'd like that:
|
||||
1. As a base, just use the structure from one of the existing FAQs files
|
||||
2. Give us a PR which includes your new file AND a change to this README so your entry is listed.
|
||||
|
||||
|
||||
## Commercial Videos Series
|
||||
|
||||
* [purelyfunctional.tv ](https://purelyfunctional.tv/guide/reagent/)
|
||||
|
|
Loading…
Reference in New Issue