WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 6273133

Browse files
committed
Update Raxml.js
1 parent 7b2e356 commit 6273133

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/app/Raxml.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react';
1+
import React, { useCallback } from 'react';
22
import { clipboard } from 'electron';
3-
import { observer } from 'mobx-react';
3+
import { observer } from 'mobx-react-lite';
44
import PropTypes from 'prop-types';
55
import Button from '@mui/material/Button';
66
import OptionSelect from './components/OptionSelect';
@@ -11,16 +11,11 @@ import IconButton from '@mui/material/IconButton';
1111
import FileCopyIcon from '@mui/icons-material/FileCopy';
1212
import { FormHelperText } from '@mui/material';
1313

14-
@observer
15-
class Raxml extends React.Component {
16-
copyCommand = () => {
17-
const { run, store } = this.props;
14+
const Raxml = ({ run, store }) => {
15+
const copyCommand = useCallback(() => {
1816
clipboard.writeText(run.command);
1917
store.setAppSnack();
20-
};
21-
22-
render() {
23-
const { run } = this.props;
18+
}, [run.command, store]);
2419

2520
return (
2621
<Box
@@ -75,7 +70,7 @@ class Raxml extends React.Component {
7570
<Tooltip aria-label="copy-command" title="Copy command">
7671
<IconButton
7772
style={{ position: 'absolute', right: 0 }}
78-
onClick={this.copyCommand}
73+
onClick={copyCommand}
7974
size="large"
8075
>
8176
<FileCopyIcon />
@@ -87,11 +82,11 @@ class Raxml extends React.Component {
8782
</Box>
8883
</Box>
8984
);
90-
}
91-
}
85+
};
9286

9387
Raxml.propTypes = {
9488
run: PropTypes.object.isRequired,
89+
store: PropTypes.object.isRequired,
9590
};
9691

97-
export default Raxml;
92+
export default observer(Raxml);

0 commit comments

Comments
 (0)