Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react 中使用,不能使页面更新,该如何使用呢? #14

Closed
jaryway opened this issue Feb 1, 2021 · 0 comments
Closed

react 中使用,不能使页面更新,该如何使用呢? #14

jaryway opened this issue Feb 1, 2021 · 0 comments

Comments

@jaryway
Copy link
Contributor

jaryway commented Feb 1, 2021

const [test, setTest] = useState<any>([
    { label: 'a', children: [{ label: 'a-0' }, { label: 'a-1', children: [{ label: 'a-0' }, { label: 'a-1' }] }] },
    { label: 'b', children: [{ label: 'b-0' }, { label: 'b-1' }] },
  ]);

  console.log('render', test);

  return (
    <>
       <div className='example-app'>
        <Button
          onClick={() => {
            const next = test;
            mv(next, '1/children/1', '0/children/1/children/1', 'before');
            console.log('test', test, next);
            setTest(next);
          }}
        >
          Click
        </Button>
      </div>
    </>

setTest 之后并没有 log render

@jaryway jaryway closed this as completed Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant