Code Monkey home page Code Monkey logo

purescript-react-basic-todomvc's Introduction

PureScript react-basic TodoMVC

An implementation of TodoMVC in PureScript using the react-basic library.

You can see this deployed here at purescript-react-basic-todomvc.netlify.com

Project structure

  • Entry point for the app is index.js, that imports React and just instantiates the Todo.Main component (defined in PureScript). This is where you might want to hook up more JS components in your project.
  • The tasklist is defined in the Main component. The list of tasks is kept in this component's State, together with some more things (e.g. the current selector, etc.)
  • The above component then creates a Task component for every task. The only state we need to keep in it is the current edits for a focused Task.
  • Some things are achieved with a thin layer of JS FFI: LocalStorage and routing

Development

## Install npm dependencies, PureScript compiler, etc
npm install

## Build the PureScript project
npm run build

## Start the dev server with hot reload and stuff
##
## Note: Parcel has hot reload on JS files only, so if you'd like to reload
## when changing PureScript files, you have two options:
## - use an editor integration - this will run `purs ide` and recompile the files you edit
## - run `spago build --watch` in another terminal
##
## Note: the hot reload won't work if you change any FFI file,
## so you'll have to `yarn build` again in this case.
npm start

purescript-react-basic-todomvc's People

Contributors

dependabot[bot] avatar ericdwhite avatar f-f avatar joelmccracken avatar milesfrain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

purescript-react-basic-todomvc's Issues

`npm run build-production` fails

$ npm run build-production

> [email protected] build-production /Users/chen/purescript-react-basic-todomvc
> spago build && parcel build index.html

[info] Installation complete.
           Src   Lib   All
Warnings   0     0     0
Errors     0     0     0
[info] Build succeeded.
๐Ÿšจ Build failed.
@parcel/namer-default: Target "main" declares an output file path of "index.js" which does not match the compiled bundle type "html".
/Users/chen/purescript-react-basic-todomvc/package.json
/Users/chen/purescript-react-basic-todomvc/package.json:5:11
  4 |   "description": "TodoMVC with purescript-react-basic",
> 5 |   "main": "index.js",
>   |           ^^^^^^^^^^ Did you mean "index.html"?
  6 |   "repository": "https://github.com/f-f/purescript-react-basic-todomvc",
  7 |   "author": "Fabrizio Ferrai <[email protected]>",
Try changing the file extension of "main" in package.json.

JSX literal exported instead of component.

React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: . Did you accidentally export a JSX literal instead of a component?

The app wouldn't run for me at all due to the above error.

`npm start` fails

$ npm start

> [email protected] start /Users/chen/purescript-react-basic-todomvc
> parcel index.html

โ„น๏ธ Server running at http://localhost:1234
๐Ÿšจ Build failed.
@parcel/core: Failed to resolve '/base.0a895d42.css' from './index.html'
@parcel/resolver-default: Cannot load file './base.0a895d42.css' in './'.

hot reload not working

steps to reproduce:

  • yarn install
  • yarn build
  • yarn start
  • open App.purs
  • change "todos" to "todos 2", save file
  • nothing recompiles

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.