Skip to content

Instantly share code, notes, and snippets.

@kurtmilam kurtmilam/form.js
Last active May 29, 2017

Embed
What would you like to do?
calmm-js crud form component experiment
const makeQuery =
U.pipe( U.template
, U.flatMapLatest( L.get( [ 0, U.pipe( Req.withParams( url ), Req.getJSON ) ] ) )
)
const getItem =
U.view( [ 'response', 'body', L.define( {} ) ] )
export const Edit =
U.withContext(
( { id } ) => {
const state = U.variable()
const item = U.view( [ 'item', L.valueOr( {} ) ], state )
const jsonFieldL = [ 'a', L.json(), L.defaults( {} ) ]
return (
<div className="crud-form">
<LabeledTextInput lens={ [ jsonFieldL, 'b' ] }
item={ item }/>
{ U.set( item, getItem( makeQuery( [ { id } ] ) ) ) }
</div>
)
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.