Skip to content

Commit

Permalink
fix: fix ref handler in loadable.lib
Browse files Browse the repository at this point in the history
  • Loading branch information
philibea authored and gregberge committed Nov 13, 2018
1 parent 3ae704a commit da05d87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/component/src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import createLoadable from './createLoadable'

export const { loadable, lazy } = createLoadable({
onLoad(result, props) {
if (result && props.ref) {
if (typeof props.ref === 'function') {
props.ref(result)
if (result && props.forwardedRef) {
if (typeof props.forwardedRef === 'function') {
props.forwardedRef(result)
} else {
props.ref.current = result
props.forwardedRef.current = result
}
}
},
Expand Down

0 comments on commit da05d87

Please sign in to comment.