How to use react-easy-state - 10 common examples

To help you get started, we’ve selected a few react-easy-state 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 solkimicreb / react-easy-params / examples / todo-mvc / src / App.jsx View on Github external
{hasCompleted && (
              <button>
                Clear completed
              </button>
            )}
          
        )}
      
    )
  }
}

// wrap the component with view() before exporting it
export default view(App)
github s-kris / rey / src / components / tabs / SearchTab.js View on Github external
renderItem={({ item }) =&gt; (
               // item.link uses too much data
            )}
          /&gt;
        )}
      
    );
  }
}

export default view(SearchTab);
github Rajan / lesspod / client / mobile-rn / src / config / Routes.js View on Github external
} /&gt;
           } /&gt;
           } /&gt;
           } /&gt;
          {/*  } /&gt;
           } /&gt;
           } /&gt;
           } /&gt;
           */}
        
      
    );
  }
}

export default view(Routes);
github carrot2 / carrot2 / dcs / contexts / frontend / src / carrot2 / search-app / ui / ResultList.js View on Github external
let rank = null;
  if (config.showRank) {
    rank = <span>{props.rank}</span>;
  }

  return (
    <a style="{{display:" rel="noopener noreferrer" href="{document.url}">
      <strong>{rank}{document.title}</strong>
      <div>{document.snippet}</div>
      {siteIcon}
    </a>
  );
}

const DocumentView = view(Document);
const ClusterSelectionSummaryView = view(ClusterSelectionSummary);

export function ResultList(props) {
  return (
    <div>
      
        
        {
          props.store.searchResult.documents.map((document, index) =&gt;
            )
        }
      
    </div>
github carrot2 / carrot2 / dcs / contexts / frontend / src / carrot2 / search-app / ui / ResultList.js View on Github external
const ResultClusters = view(props =&gt; {
  const selectionStore = clusterSelectionStore;
  return (
    <div>
      <span>
      {
        (props.result.clusters || []).map(c =&gt;
           selectionStore.toggleSelection(c)} /&gt;)
      }
      </span>
    </div>
  );
});

const Result = view(props =&gt; {
  const document = props.document;
  const config = props.commonConfigStore;
  const source = sources[props.source];

  return (
    <a style="{{display:" rel="noopener noreferrer" href="{document.url}">
      {source.createResult(props)}
        } /&gt;
    </a>
  );
});

const ClusterSelectionSummaryView = view(ClusterSelectionSummary);

export function ResultList(props) {
github carrot2 / carrot2 / dcs / contexts / frontend / src / carrot2 / search-app / ui / ResultsScreen.js View on Github external
import { routes } from "../routes";

import { ReactComponent as CarrotLogo } from "../ui/assets/carrot-search-logo.svg";

import { ResultList } from "./ResultList";
import { Switcher } from "./Switcher.js";
import { SearchForm } from "./SearchForm";

import { ViewTabs } from "./Views.js";

import { branding } from "../../config-branding.js";

const ResultListView = view(ResultList);

const Loading = view(props =&gt; (
  
    Loading
  
));

export class ResultsScreen extends Component {
  runSearch() {
    searchResultStore.load(this.getSource(), this.getQuery());
    document.title = this.getQuery() + (this.getQuery().length &gt; 0 ? " - " : "") + branding.pageTitle;
  }

  componentDidMount() {
    this.runSearch();
    this.prevSource = this.getSource();
  }
github youzan / show-me-the-code / client / components / output.tsx View on Github external
return <div>undefined</div>;
    case 'object':
      if (data === null) {
        return <div>null</div>;
      } else if (data instanceof Error) {
        return <div>{data.message}</div>;
      }
      return ;
    case 'symbol':
      return <div>{data.toString()}</div>;
    default:
      return <div>{'' + data}</div>;
  }
});

const OutputLine = view&gt;(({ data }) =&gt; (
  <div>
    {data.map((data, index) =&gt; (
      
    ))}
  </div>
));
OutputLine.displayName = 'OutputLine';

const OutputBlock = view&gt;(({ data }) =&gt; (
  <div>
    {data.map((data, index) =&gt; (
      
    ))}
  </div>
));
OutputBlock.displayName = 'OutputBlock';
github GantMan / ReactStateMuseum / React / react-easy-state / src / index.js View on Github external
*
 * https://github.com/GantMan/ReactStateMuseum
 ************************************************/
import React from "react";
import { render } from "react-dom";
import { view } from "react-easy-state";
import { items } from "./store";
import ListItems from "./Components/listItems";
import AddItems from "./Components/addItem";

const styles = {
  fontFamily: "sans-serif",
  textAlign: "center"
};

const App = view(() =&gt; {
  const { newItem, allItems, setNewItemValue, addItem, clearItems } = items;

  return (
    <div style="{styles}">
      <h2>Welcome to React Easy State!</h2>
       setNewItemValue(event.target.value)}
        value={newItem}
        clear={clearItems}
      /&gt;
      
    </div>
  );
});
github carrot2 / carrot2 / dcs / contexts / frontend / src / carrot2 / search-app / ui / ResultList.js View on Github external
import './ResultList.css';

import React, { useEffect, useRef } from 'react';
import PropTypes from "prop-types";

import { view } from "react-easy-state";
import { observe, unobserve } from "@nx-js/observer-util";
import { ClusterSelectionSummary, ClusterInSummary } from "./ClusterSelectionSummary.js";
import { Optional } from "./Optional.js";

import { sources } from "../../config-sources.js";
import { clusterSelectionStore } from "../store/selection.js";

const ResultClusters = view(props =&gt; {
  const selectionStore = clusterSelectionStore;
  return (
    <div>
      <span>
      {
        (props.result.clusters || []).map(c =&gt;
           selectionStore.toggleSelection(c)} /&gt;)
      }
      </span>
    </div>
  );
});

const Result = view(props =&gt; {
  const document = props.document;
  const config = props.commonConfigStore;

react-easy-state

React state management with a minimal API. Made with ES6 Proxies.

MIT
Latest version published 6 years ago

Package Health Score

56 / 100
Full package analysis

Popular react-easy-state functions