Home - notsunohito/orex GitHub Wiki
Welcome to the orex wiki!
Getting started
$ git clone https://github.com/notsunohito/orex
$ cd orex
$ npm install
$ cd examples/helloworld
$ npm install
$ npm start
The entire code of the example is here.
import React from 'react'
import {render} from 'react-dom'
import {createStore, Provider} from 'orex'
const initialState = { message: 'Hello World!' }
const store = createStore(initialState)
const HelloWorld = ({state, action})=> (
<div>
<input
type="text"
value={state.message}
onChange={(e)=> action.message.set(e.target.value)}
/>
<p>{state.message}</p>
</div>
)
render(
<Provider store={store}>
<HelloWorld />
</Provider>,
document.querySelector('#app')
)
<!-- public/index.html -->
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Greetings</title>
</head>
<body>
<div id="app"></div>
<script src="bundle.js"></script>
</body>
</html>
Try it out
You can modify src/index.js, and $npm start
to check what will happen.