Skip to content
Vesa Karvonen edited this page Jul 21, 2017 · 1 revision

Using create-react-app with latest Node (8.2.0) and NPM (5.3.0):

First set up the project from (Bash) console:

npx create-react-app my-app
cd my-app
npm i --save karet karet.util partial.lenses
npm run start

Point your browser at http://localhost:3000/ and you should see the app running.

Then open editor and change app.js to contain (only):

import * as React from 'karet'
import * as U from 'karet.util'

export default ({value = U.atom(0)}) =>
  <div>
    <div>Count: {value}</div>
    <button onClick={() => value.modify(U.add(+1))}>+</button>
    <button onClick={() => value.modify(U.add(-1))}>-</button>
  </div>

You should now see the counter component in your browser.