How to use the mobx-react-lite.useObserver function in mobx-react-lite

To help you get started, we’ve selected a few mobx-react-lite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github molenzwiebel / Mimic / frontend / views / ChampionSelect.tsx View on Github external
export default function ChampionSelect() {
    return useObserver(() => {
        if (!champSelect.state) return null;

        return (
            
                
                
                

                {/* Absolute Positioned Elements */}
                
                
                
                
            
        );
    });
github molenzwiebel / Mimic / frontend / components / root / CreateLobby.tsx View on Github external
function SelectedSectionName() {
    // This can't be a text directly since the bottom border doesn't render on iOS.
    return useObserver(() => (
        
            {getGamemodeName(store.selectedSection).toUpperCase()}
        
    ));
}
github molenzwiebel / Mimic / frontend / components / root / CreateLobby.tsx View on Github external
function Queues() {
    return useObserver(() => {
        const queues = store.availableQueues[store.selectedSection] || [];

        return (
            
                {queues.map(x => (
                    
                ))}
            
        );
    });
}
github molenzwiebel / Mimic / frontend / components / root / Root.tsx View on Github external
function Footer({ onSettings }: { onSettings: Function }) {
    return useObserver(() => (
        
            {socket.computerName}
             onSettings()}>
                
            
        
    ));
}
github mobxjs / mst-gql / examples / 4-apollo-tutorial / client / src / storeContext.js View on Github external
export function useMutation(component) {
  const store = useContext(StoreContext)
  const [queryMutation, startMutation] = useState(null)
  return useObserver(() =>
    component(store, startMutation, {
      loading: queryMutation ? queryMutation.loading : false,
      error: queryMutation ? queryMutation.error : undefined,
      data: queryMutation ? queryMutation.data : undefined
    })
  )
}
github mobxjs / mst-gql / examples / 4-apollo-tutorial / client / src / storeContext.js View on Github external
export function withStore(component) {
  const store = useContext(StoreContext)
  return useObserver(() => component(store))
}
github molenzwiebel / Mimic / frontend / components / root / CreateLobby.tsx View on Github external
function Sections() {
    return useObserver(() => (
        
            {store.sections.map(x => (
                <section selected="{store.selectedSection" id="{x}">
            ))}
        
    ));
}
</section>
github orbitdb / orbit-web / src / containers / ChannelMessages.js View on Github external
function ChannelMessages ({ channel }) {
  const { sessionStore, uiStore } = useContext(RootContext)

  function onMessageUserClick (evt, profile, identity) {
    evt.persist()
    evt.stopPropagation()
    uiStore.openUserProfilePanel({ identity, profile }, getMousePosition(evt))
  }

  return useObserver(() =&gt; (
    <div>
      </div>
github mobxjs / mst-gql / examples / 4-apollo-tutorial / client / src / storeContext.js View on Github external
export function renderQuery(query, variables, handlers) {
  const store = useContext(StoreContext)
  const [queryResult] = useState(() => store.query(query, variables))
  return useObserver(() => queryResult.case(handlers))
}
github zeit / next.js / examples / with-mobx-react-lite / components / Page.js View on Github external
function Page({ linkTo, title }) {
  const store = useContext(StoreContext)

  useEffect(() =&gt; {
    start()
    return stop
  }, [])

  return (
    <div>
      <h1>{title}</h1>
      {useObserver(() =&gt; (
        
      ))}
      <nav>
        
          <a>Navigate</a>
        
      </nav>
    </div>
  )
}

mobx-react-lite

Lightweight React bindings for MobX based on React 16.8+ and Hooks

MIT
Latest version published 7 months ago

Package Health Score

96 / 100
Full package analysis