diff --git a/packages/shared/isValidElementType.js b/packages/shared/isValidElementType.js new file mode 100644 index 00000000000..f08f002dc58 --- /dev/null +++ b/packages/shared/isValidElementType.js @@ -0,0 +1,18 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +function isValidElementType(type) { + return ( + typeof type === 'string' || + typeof type === 'function' || + (type != null && typeof type === 'object' && 'render' in type) + ); +} + +module.exports = isValidElementType;