generated from react-component/portal
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: solve findDOMNode throw warning in strict mode problem (#28)
* fix: fix findDOMNOde throw wraning in strict mode problem * fix: fix findDOMNOde throw wraning in strict mode problem * feat: code optimize * feat: remove redundant code * feat: update test case * chore: update dumi version
- Loading branch information
1 parent
dfc0339
commit 2f55c23
Showing
6 changed files
with
451 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: strictMode | ||
nav: | ||
title: Demo | ||
path: /demo | ||
--- | ||
|
||
<code src="../examples/strictMode.tsx"></code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, { StrictMode, useRef } from 'react'; | ||
import Tour from '../../src/index'; | ||
import './basic.less'; | ||
|
||
const App = () => { | ||
const [open, setOpen] = React.useState(false); | ||
const btn1 = useRef<HTMLButtonElement>(null); | ||
|
||
return ( | ||
<div style={{ margin: 20 }}> | ||
<button | ||
onClick={() => { | ||
setOpen(!open); | ||
}} | ||
> | ||
Open: {String(open)} | ||
</button> | ||
<button ref={btn1}>Upload</button> | ||
|
||
<Tour | ||
placement={'bottom'} | ||
open={open} | ||
onFinish={() => setOpen(false)} | ||
steps={[ | ||
{ | ||
title: '创建', | ||
description: '创建一条数据', | ||
target: undefined, | ||
}, | ||
{ | ||
title: '更新', | ||
description: '更新一条数据', | ||
target: () => btn1.current, | ||
}, | ||
]} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default () => { | ||
return ( | ||
<StrictMode> | ||
<App /> | ||
</StrictMode> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
2f55c23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
tour – ./
tour-git-master-react-component.vercel.app
tour-react-component.vercel.app
tour-dun.vercel.app