1- import React from 'react' ;
1+ import React , { useCallback } from 'react' ;
22import { clipboard } from 'electron' ;
3- import { observer } from 'mobx-react' ;
3+ import { observer } from 'mobx-react-lite ' ;
44import PropTypes from 'prop-types' ;
55import Button from '@mui/material/Button' ;
66import OptionSelect from './components/OptionSelect' ;
@@ -11,16 +11,11 @@ import IconButton from '@mui/material/IconButton';
1111import FileCopyIcon from '@mui/icons-material/FileCopy' ;
1212import { 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
9387Raxml . 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