Coder Social home page Coder Social logo

recksjs / recks Goto Github PK

View Code? Open in Web Editor NEW
139.0 139.0 9.0 2.32 MB

๐Ÿถ React-like RxJS-based framework

Home Page: https://recks.gitbook.io/

License: MIT License

JavaScript 1.94% TypeScript 98.06%
dom framework jsx react rxjs typescript

recks's People

Contributors

demensky avatar kosich 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  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

recks's Issues

Type definition allows component props to be static

As reported in recksjs/recks-starter-project#4, TS accepts components to be both:

// VALID
function Foo(props$: Observable<{ value: string}> ) {
    return <div>{props$.pipe(map(x => x.value))}</div>
}

// INVALID, BUT ACCEPTED BY TS
function Bar(props: { value: string } ) {
    return <div>{props.value}</div>
}

Though Recks TS definitions for JSX allow use of both:

const timer$ = timer(0, 1000);
{timer$.pipe(map(value => <Foo value={value}/>))}
{timer$.pipe(map(value => <Bar value={value}/>))}

The Bar type is incorrect, since components currently only accept Observable<โ€ฆ> as props, and TS should throw an error in this case.

Thanks, @user753 , for reporting this!

Let components receive Observables as props

Currently we allow intrinsic elements to receive Observable attributes, e.g.:

<img src={ of('/bird.png') } /> // > ๐Ÿฆ‰

Components don't support this feature yet, and passing an Observable to a component results in Component to be of type fn (props$: Observable<{ [key: string]: Observable<โ€ฆ> }>), which leads to boilerplate code. E.g:

<Header title={ of('title') } />

function Header(props: Observable<{ title: Observable<string> }>) {โ€ฆ}

With components it's unclear how exactly the API should look like: props: Observable<{ title: string }> or props: { title: Observable<string> } or a combination of two, or something else.

This issue is a place for further discussions and investigations of this API.

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.