Skip to content

Commit

Permalink
quickfix useEffet page + localstorage persistence done
Browse files Browse the repository at this point in the history
  • Loading branch information
rb-x committed Jan 21, 2023
1 parent 712a9b0 commit ce84f2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/components/LayoutApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ export default function LayoutApp ( props: {
const handleHatClick = () => {
// navigate( Notepad );
const notepad_route_ctx ={
key: '0',
key: '1', // to prevent error in useEffect
name: 'Hat Clicked',
componentRoute: Notepad
}

navigate( notepad_route_ctx );
};

Expand Down
16 changes: 11 additions & 5 deletions src/components/notepad/Notepad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@ import { Button, Input, Typography, message, Divider, Menu, Dropdown } from 'ant
import { CopyOutlined, createFromIconfontCN, ClearOutlined, DownOutlined } from '@ant-design/icons';
import Clipboard from 'react-clipboard.js';
import escape_quotes from 'escape-quotes';

import MDEditor from '@uiw/react-md-editor';
const { Title, Paragraph } = Typography;
import PersistedState from 'use-persisted-state';
const IconFont = createFromIconfontCN( {
scriptUrl: [ './iconfont.js' ]
} );


const NOTEPAD = () => {

const [value, setValue] = PersistedState('ht_notepad_content')('');
return (
<div>
NOTEPAD
</div>
<div className="container">
<MDEditor
value={value}
onChange={setValue}
/>
{/* <MDEditor.Markdown source={value} /> */}
</div>
);

};

export default NOTEPAD;

0 comments on commit ce84f2f

Please sign in to comment.