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:
Sebastian Markbage
2016-10-17 16:21:06 -04:00
committed by Sebastian Markbåge
parent 685d65bfb6
commit fae3e5308b
2 changed files with 2 additions and 3 deletions
+1
View File
@@ -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);
}
}