diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..99fd15d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +# Unix-style newlines with a newline ending every file +end_of_line = lf +indent_style = space +insert_final_newline = true +charset = utf-8 +indent_size = 4 + +[*.{js, ts, css}] +indent_size = 2 +quote_type = single diff --git a/src/App.js b/src/App.js index a77edfd..f25b886 100644 --- a/src/App.js +++ b/src/App.js @@ -2,11 +2,11 @@ import React from 'react'; import './App.css'; import Luckysheet from './component/Luckysheet' -function App() { +const App = () => { return (
- +
); diff --git a/src/component/Luckysheet.js b/src/component/Luckysheet.js index a1a8344..4e59879 100644 --- a/src/component/Luckysheet.js +++ b/src/component/Luckysheet.js @@ -1,29 +1,26 @@ -import React from 'react'; -class Luckysheet extends React.Component { +import React, { useEffect } from 'react'; - componentDidMount() { - const luckysheet = window.luckysheet; - luckysheet.create({ - container: "luckysheet", - }); - } - render() { - const luckyCss = { - margin: '0px', - padding: '0px', - position: 'absolute', - width: '100%', - height: '100%', - left: '0px', - top: '0px' - } - return ( -
- ) - } +const Luckysheet = () => { + useEffect(() => { + const luckysheet = window.luckysheet; + luckysheet.create({ + container: 'luckysheet', + }); + }, []); + + const luckyCss = { + margin: '0px', + padding: '0px', + position: 'absolute', + width: '100%', + height: '100%', + left: '0px', + top: '0px' + }; + + return ( +
+ ); } -export default Luckysheet \ No newline at end of file +export default Luckysheet;