-
-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fre2: New reconcilation algorithm (#200)
* first rendering * first time is ok * ototype * remove types * mplete * kkkkkk * mplete * new reconcilation * update readme * Update README.md * fix s * some case * Update README.md * Bump node-notifier from 8.0.0 to 8.0.1 (#194) Bumps [node-notifier](https://github.com/mikaelbr/node-notifier) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/mikaelbr/node-notifier/releases) - [Changelog](https://github.com/mikaelbr/node-notifier/blob/v8.0.1/CHANGELOG.md) - [Commits](mikaelbr/node-notifier@v8.0.0...v8.0.1) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix typo in README.md (#196) * fix diff bug * fix diff bug * finish diff * finish diff * finish diff * fix bug * fix many bugs * something went right * passed all tests * Update README.md (#197) 拼写错误 * docs: fix typo (#198) * simplify * fix bug * reduce woords * change words * simplify * simplify Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: inokawa <[email protected]> Co-authored-by: Changhao Zhao (赵昌浩) <[email protected]> Co-authored-by: suchangv <[email protected]> Co-authored-by: 琚致远 <[email protected]>
- Loading branch information
1 parent
64d075a
commit e727583
Showing
15 changed files
with
351 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { h, render, useEffect, useState } from '../../src/index' | ||
|
||
// function App() { | ||
// const [key, setKey] = useState(['a', 'b', 'c']) | ||
// return [ | ||
// <button onClick={() => setKey(['a', 'c', 'b','d'])}>x</button>, | ||
// <ul> | ||
// {key.map((i) => ( | ||
// <li key={i}>{i}</li> | ||
// ))} | ||
// </ul>, | ||
// ] | ||
// } | ||
|
||
// function App() { | ||
// const [key, setKey] = useState(['a', 'b', 'c']) | ||
// return [ | ||
// <button onClick={() => setKey(['b', 'c', 'a'])}>x</button>, | ||
// <ul> | ||
// {key.map((i) => ( | ||
// <li key={i}>{i}</li> | ||
// ))} | ||
// </ul>, | ||
// ] | ||
// } | ||
|
||
// function App() { | ||
// const [key, setKey] = useState(['a', 'b', 'c']) | ||
// return [ | ||
// <button onClick={() => setKey(['c', 'b','a'])}>x</button>, | ||
// <ul> | ||
// {key.map((i) => ( | ||
// <li key={i}>{i}</li> | ||
// ))} | ||
// </ul>, | ||
// ] | ||
// } | ||
|
||
function App() { | ||
const [key, setKey] = useState([1, 2]) | ||
return [ | ||
<button onClick={() => setKey([3, 2, 1])}>x</button>, | ||
<ul> | ||
{key.map((i) => ( | ||
<Li i={i} key={i} /> | ||
// <li key={i}>{i}</li> | ||
))} | ||
</ul>, | ||
] | ||
} | ||
|
||
function Li(props) { | ||
return <li>{props.i}</li> | ||
} | ||
|
||
render(<App />, document.getElementById('root')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** @jsx h */ | ||
|
||
// // preact: | ||
// import { render, createElement as h } from "preact/compat"; | ||
// import { useState, useEffect } from "preact/hooks"; | ||
|
||
// react: | ||
// import { createElement as h, useState, useEffect } from "react"; | ||
// import { render } from "react-dom"; | ||
|
||
// // fre: | ||
import { render, h, useState, useEffect, useRef } from '../../src' | ||
|
||
|
||
const Wrapper = () => { | ||
const [showApp, setShowApp] = useState(true) | ||
|
||
useEffect(()=>{ | ||
setTimeout(() => { | ||
setShowApp(false) | ||
}, 2000) | ||
},[]) | ||
|
||
const p = dom => { | ||
if (dom) { | ||
} else { | ||
console.log(111) | ||
} | ||
} | ||
const c = dom => { | ||
if (dom) { | ||
} else { | ||
console.log(222) | ||
} | ||
} | ||
console.log(showApp) | ||
|
||
return showApp ? <div ref={p}> | ||
<p ref={c}>before</p> | ||
</div> : <p>App removed...</p> | ||
} | ||
|
||
render(<Wrapper />, document.getElementById('root')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { h, render, useState, useEffect, useLayoutEffect } from '../../src' | ||
|
||
function App() { | ||
const [count, setCount] = useState(0) | ||
return ( | ||
<div> | ||
{count < 5 && <A count={count < 1 ? count : 2} />} | ||
<h1>{count}</h1> | ||
<button onClick={() => setCount(count + 1)}>+</button> | ||
</div> | ||
) | ||
} | ||
|
||
function A(props) { | ||
useLayoutEffect(() => { | ||
console.log(333) | ||
return () => { | ||
console.log(444) | ||
} | ||
}) | ||
return <div>{props.count}</div> | ||
} | ||
|
||
render(<App />, document.body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.