choojs / choojs/choo

Documentation for how to handle DOM refs within a component/view

Open
#488 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6.8k
Forks
573
PR merge metrics
No merged PRs in 30d

Description

Not sure if just a docs issue, but seems to be taking a lot of figuring out, thanks! Sorry if I've missed something obvious.

### Expected behavior

Docs to show me how to get a reference to one dom node from another in same view, e.g. access the value of an input, in the `onclick` handler of a button in the same form. (Like a [`refs` callback](https://facebook.github.io/react/docs/refs-and-the-dom.html) in React).

### Actual behavior

Can't find an example of this. In the todo example (as it uses enter key), in the handbook, or in `bel` docs. Tried using `onload` but that only works *once*, see below.

### Steps to reproduce behavior

Attempt using `onload` which only works first time we `add` (presumably DOM node gets blown away on next render), **NOTE: you will have to go to the `package.json` tab and change `choo` version to `5.4.0`, it refuses to save**: http://requirebin.com/?gist=02f05c009e84bb7cbeeed4e62d095b42

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.