`, ``, ``, etc.
This HTML format has been converted to Markdown.
### Markdown format
For reference, [this post on StackOverflow](https://stackoverflow.com/questions/53253940/make-react-useeffect-hook-not-run-on-initial-render) is formatted as follows:
#### Title: Make React useEffect hook not run on initial render
```markdown
According to the docs:
> `componentDidUpdate()` is invoked immediately after updating occurs. This method is not called for the initial render.
We can use the new `useEffect()` hook to simulate `componentDidUpdate()`, but it seems like `useEffect()` is being ran after every render, even the first time. How do I get it to not run on initial render?
As you can see in the example below, `componentDidUpdateFunction` is printed during the initial render but `componentDidUpdateClass` was not printed during the initial render.
```
function ComponentDidUpdateFunction() {
const [count, setCount] = React.useState(0);
React.useEffect(() => {
console.log(""componentDidUpdateFunction"");
});
return (
componentDidUpdateFunction: {count} times
);
}
```
rest of the post omitted for brevity
```
## Details on the HTML to Markdown conversion
Using Jsoup, the original Body field was converted into a Jsoup Document. The child **nodes** (has special meaning in context of Jsoup) of this document were recursively traversed in a depth-first order.
Jsoup defines `.text()` as follows:
> ... the normalized, combined text of this element and all its children. Whitespace is normalized and trimmed. For example, given HTML <p>Hello <b>there</b> now! </p>, p.text() returns "Hello there now!"
Jsoup defines a `Node` as follows:
> The base, abstract Node model. Elements, Documents, Comments etc are all Node instances.
Additionally the existence of the `TextNode` should be noted, which represents floating text inside an HTML document that is not itself an HTML element.
Thus this text tag `HelloWorld
` would have two Jsoup child nodes `TextNode(value="Hello")` and `Element(tag="code", value="World")`.
The value `field` of a `TextNode` contains the free standing text without any further treatment (no whitespace stripping, etc.)
### Traversing Rules
- When ecountering a html tag for which a rule exists, children are not further traversed, **unless explicitly stated otherwise**.
- When encountering an `` tag, `[${element.text()}](${element.attr("href")})` is emitted.
- When encountering an `` tag, `\n# ${element.text()}\n\n` is emitted.
- When encountering an `` tag, `\n## ${element.text()}\n\n` is emitted.
- When encountering an `` tag, `\n### ${element.text()}\n\n` is emitted.
- When encountering an `` tag, `\n#### ${element.text()}\n\n` is emitted.
- When encountering an `` tag, `\n##### ${element.text()}\n\n` is emitted.
- When encountering an `` tag, `\n###### ${element.text()}\n\n` is emitted.
- When encountering a `` tag, `` `${element.text()}` ``is emitted
- When encountering a `` tag and said element **has** a `` child tag, `` ```\n${element.text()}`\n```\n`` is emitted.
- When encountering a `` tag and said element **does not** have a `` child tag, **children are traversed further**.
- When encountering an `- ` tag, `- ` is emitted and **children are traversed further**.
- When encountering a `
` tag, `> ` is emitted and **children are traversed further**.
- When encountering an `
` tag, `\n---\n\n` is emitted
- When encountering an `` tag, `![${element.attr("alt")}](${element.attr("src")})` is emitted.
- When encountering a `` tag
- `\n| ` is emitted
- For each element of `element.select("th")`
- `${element.text()} | ` is emitted
- After the loop `\n| ` is emitted
- For each element of `element.select("th")`
- For each character of the `th.text()`
- `-` is emitted
- After the loop over each character of th ` | ` is emitted
- `\n` is emitted
- For each element of `element.select("tr")` with more than one children of tag type `td`
- `| ` is emitted
- For each element of `element.select("td")`
- `${td.text()} | ` is emitted
- After the loop over `` elements, `\n` is emitted
- After the loop over ` ` elements, `\n` is emitted
- When encountering a jsoup `TextNode`, `${node.attr(node.nodeName())}` (which is equivalent to accessing the private field `node.value`) is emitted.