Giter Club home page Giter Club logo

fulcrodemos's Introduction

Fulcro Demos

Small demos of how to do various things in Fulcro, leveraging Workspaces for running all the demo applications.

Demos that need a backend use in-browser Pathom (similarly to minimalist-fulcro-template-backendless).

Available Examples

trivial-cards (by jarrett)

A demo of the simplest possible frontend-only, stateful app - a click counter.

data-view-cards a.k.a. pivot table (by Tony Kay)

Topics: performance, derived data, transact!!

We want to show a list of apartments, with their various properties, in an editable table. The catch is that we want to show each apartment as a column, not a row. Also, there could be potentially very many attributes, and we want to make sure that we re-render only what changed and not everything, when an apartment attribute is modified. (In this case it is a premature optimization - the table is too small to matter. We do it just for demonstration purposes. In practice, measure before you optimize. The performance of the common approach is surprising good and sufficient in all but the most extreme cases.)

The solution is to define a query-only Apartment component for fetching the data, and then "pivoting" the data into a column-based table in a post-mutation, and storing the result under the Table in the client DB. For the performance, we use the synchronous transact!! when we edit a cell in the table, so that only that one cell is re-rendered. Each cell has a :target property pointing to the apartment, so the raw data is only stored in the :apartment/id table. Look at the data using Fulcro Inspect, and explore the code.

Also noteworthy: While idents are normally [<kwd> <id: a primitive value>], they don’t need to - the id part may be more complex. We leverage it here to encode in each Cell’s ident both the apartment and the attribute it displays. Have a look at the namespace docstring for more details.

Usage

Run yarn install and then either yarn run it, bb watch, or directly npx shadow-cljs watch :workspaces.

Then navigate to http://localhost:9001 and enjoy. This opens the Workspaces UI, which displays all the available "cards" (i.e. demo applications). Just click on one to display it. You can also maximize it via its ⠇ menu → Solo, see its source from there etc. Use the [Inspector] button to open Fulcro Inspect focused on that app.

Contributing

Simply add a new src/examples/<whatever>_cards.cljs with your content.

fulcrodemos's People

Contributors

abhi18av avatar acobster avatar awkay avatar dijonkitchen avatar holyjak avatar jmarca avatar mrebbinghaus avatar pithyless avatar wilkerlucio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.