Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
react-keep-alive
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
react-keep-alive
Commits
d9d931cd
Commit
d9d931cd
authored
Mar 22, 2019
by
Shen Chang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(Provider): <Provider> nesting error
parent
e95cef41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
demo/src/views/A.js
demo/src/views/A.js
+9
-4
src/components/Provider.tsx
src/components/Provider.tsx
+0
-1
No files found.
demo/src/views/A.js
View file @
d9d931cd
import
React
from
'
react
'
;
import
{
bindLifecycl
e
}
from
'
../../../es
'
;
import
{
Provider
,
KeepAliv
e
}
from
'
../../../es
'
;
@
bindLifecycle
class
Content
extends
React
.
Component
{
componentWillMount
()
{
console
.
log
(
'
A Content componentWillMount
'
);
...
...
@@ -40,7 +39,6 @@ class Content extends React.Component {
}
}
@
bindLifecycle
class
Test
extends
React
.
Component
{
state
=
{
index
:
0
,
...
...
@@ -84,7 +82,14 @@ class Test extends React.Component {
<
div
>
<
div
>
This
is
a
.
<
/div
>
<
button
onClick
=
{
this
.
handleClick
}
>
click
me
({
this
.
state
.
index
})
<
/button
>
<
Content
/>
{
this
.
state
.
index
%
2
&&
<
Provider
>
<
KeepAlive
key
=
"
111
"
>
<
Content
/>
<
/KeepAlive
>
<
/Provider
>
}
<
/div
>
);
}
...
...
src/components/Provider.tsx
View file @
d9d931cd
...
...
@@ -73,7 +73,6 @@ export default class KeepAliveProvider extends React.PureComponent<IKeepAlivePro
}
public
componentWillUnmount
()
{
this
.
eventEmitter
.
clear
();
this
.
existed
=
false
;
document
.
body
.
removeChild
(
this
.
storeElement
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment