Skip to content

Commit

Permalink
render time check
Browse files Browse the repository at this point in the history
  • Loading branch information
imjordanxd committed Dec 10, 2024
1 parent 907dd70 commit 90a2272
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/mobx-react-lite/src/ObserverComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ interface IObserverProps {
}

function ObserverComponent({ children, render }: IObserverProps) {
if (children && render) {
console.error(
"MobX Observer: Do not use children and render in the same time in `Observer`"
)
}
const component = children || render
if (typeof component !== "function") {
return null
Expand Down

0 comments on commit 90a2272

Please sign in to comment.