Giter Site home page Giter Site logo

ui-modeling-with-statecharts's Introduction

UI-modeling with statecharts

Welcome! This repository contains all files for the JS/TS-guild workshop "UI-modeling with statecharts".

Presentation

The presentation was implemented with sli.dev and the source code is located in the presentation-directory.

Download the presentation as PDF

Workshop

Your task in this workshop is to implement application logic for a Wordle-game using XState. The workshop template (React) with UI-components and some utilities is located in the exercise-subdirectory.

Open terminal in the exercise-directory and run the following commands:

    npm ci
    npm run dev

The app will start in http://localhost:3000 with hot reloading. During the startup the app will also open xstate inspector in another tab, where you can see your statechart visualized.

When the game is initialized, you have to acquire a random word from a "database" to be guessed by the user. There is a small API for accessing the "database" in file words-db.js. In the first part of the workshop, use the synchronous pickRandomWord-function to initialize the game.

If you have time left, you can also implement async initialization. In addition to pickRandomWord there's also a fake API function pickRandomWordAsync in words-db.js. It simulates an API-call by returning a promise, which fails 25% of the time. Use the pickRandomWordAsync instead of pickRandomWord. Remember to handle "loading", "error" and "success" states :-)

Tips

If you want, you can start modeling the UI visually using the Stately editor (beta) and then export it to use in your xstate machine.

In order to get familiar with xstate, you can browse the documentation, or watch the official beginner's guide in Youtube.

Solution

Example implementation for the workshop (using pickRandomWordAsync) is located in the solution-directory. You can take a peek, if you get stuck.

Links

ui-modeling-with-statecharts's People

Contributors

pretseli 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.