mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Use memoizedState in componentDidUpdate
We forgot to clone this value so it didn't work before. This is covered by existing tests in ReactDOMProduction.
This commit is contained in:
committed by
Sebastian Markbåge
parent
685d65bfb6
commit
fae3e5308b
@@ -253,6 +253,7 @@ exports.cloneFiber = function(fiber : Fiber, priorityLevel : PriorityLevel) : Fi
|
||||
alt.pendingWorkPriority = priorityLevel;
|
||||
|
||||
alt.memoizedProps = fiber.memoizedProps;
|
||||
alt.memoizedState = fiber.memoizedState;
|
||||
alt.output = fiber.output;
|
||||
|
||||
return alt;
|
||||
|
||||
@@ -289,9 +289,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
|
||||
} else {
|
||||
if (typeof instance.componentDidUpdate === 'function') {
|
||||
const prevProps = current.memoizedProps;
|
||||
// TODO: This is the new state. We don't currently have the previous
|
||||
// state anymore.
|
||||
const prevState = instance.state || null;
|
||||
const prevState = current.memoizedState;
|
||||
instance.componentDidUpdate(prevProps, prevState);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user