1.0.6 • Published 4 years ago

react-tobe v1.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

React-Tobe

To be or not to be, that is the question !

Declarative condition in jsx

The Past

export default ({ loading }) => {
    return loading ? <span>is loading</span> : <span> done </span>
}

The Feature

With react-tobe, things are more react.

import { Choose, Tobe, OrNot } from 'react-tobe'
export default ({ loading }) => {
    return (
        <Choose condition={loading}>
            <Tobe>is loading</Tobe>
            <OrNot>done</OrNot>
        </Choose>
    )
}

And it's easier to debug on the react devtools for conditional rendering!

Lazy Rendering

With functional child component, element create can be deferred to specific branch rendering!

import { Choose, Tobe, OrNot } from 'react-tobe'
export default ({ loading }) => {
    return (
        <Choose condition={loading}>
            <Tobe>is loading</Tobe>
            <OrNot>
            {
                () => <span> done </span>
            }
            </OrNot>
        </Choose>
    )
}
1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago