Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
createComponent moved from the default export
Browse files Browse the repository at this point in the history
  • Loading branch information
szympajka committed Feb 2, 2019
1 parent 2567387 commit 46c36fb
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 58 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "snabbdom-react-components",
"version": "0.1.0-pre",
"version": "0.1.1-pre",
"description": "React like, Snabbdom based, Virtual Dom framework for JavaScript Web Applications",
"keywords": ["React", "Snabbdom", "VNode", "VDom", "Virtual Dom", "Virtual Node", "Styled Components", "Redux"],
"main": "prod/src.cjs.js",
Expand Down
37 changes: 12 additions & 25 deletions prod/src.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8454,30 +8454,17 @@ var styled$1 = styled_1.styled,
css$1 = styled_1.css,
cssWithProps$1 = styled_1.cssWithProps,
cssWithPropsPlain$1 = styled_1.cssWithPropsPlain;
var src = component;
var h_1 = h;
var css_1 = css$1;
var lazy_1$1 = lazy_1;
var patch_1 = patch;
var styled_1$1 = styled$1;
var cssWithProps_1 = cssWithProps$1;
var cssWithPropsPlain_1 = cssWithPropsPlain$1;
var createAsyncComponent_1 = componentAsync;
src.h = h_1;
src.css = css_1;
src.lazy = lazy_1$1;
src.patch = patch_1;
src.styled = styled_1$1;
src.cssWithProps = cssWithProps_1;
src.cssWithPropsPlain = cssWithPropsPlain_1;
src.createAsyncComponent = createAsyncComponent_1;
var snabbomReactComponents = {
h: h,
css: css$1,
lazy: lazy_1,
patch: patch,
styled: styled$1,
cssWithProps: cssWithProps$1,
createComponent: component,
cssWithPropsPlain: cssWithPropsPlain$1,
createAsyncComponent: componentAsync
};
var src = snabbomReactComponents;

exports.default = src;
exports.h = h_1;
exports.css = css_1;
exports.lazy = lazy_1$1;
exports.patch = patch_1;
exports.styled = styled_1$1;
exports.cssWithProps = cssWithProps_1;
exports.cssWithPropsPlain = cssWithPropsPlain_1;
exports.createAsyncComponent = createAsyncComponent_1;
30 changes: 12 additions & 18 deletions prod/src.js
Original file line number Diff line number Diff line change
Expand Up @@ -8448,23 +8448,17 @@ var styled$1 = styled_1.styled,
css$1 = styled_1.css,
cssWithProps$1 = styled_1.cssWithProps,
cssWithPropsPlain$1 = styled_1.cssWithPropsPlain;
var src = component;
var h_1 = h;
var css_1 = css$1;
var lazy_1$1 = lazy_1;
var patch_1 = patch;
var styled_1$1 = styled$1;
var cssWithProps_1 = cssWithProps$1;
var cssWithPropsPlain_1 = cssWithPropsPlain$1;
var createAsyncComponent_1 = componentAsync;
src.h = h_1;
src.css = css_1;
src.lazy = lazy_1$1;
src.patch = patch_1;
src.styled = styled_1$1;
src.cssWithProps = cssWithProps_1;
src.cssWithPropsPlain = cssWithPropsPlain_1;
src.createAsyncComponent = createAsyncComponent_1;
var snabbomReactComponents = {
h: h,
css: css$1,
lazy: lazy_1,
patch: patch,
styled: styled$1,
cssWithProps: cssWithProps$1,
createComponent: component,
cssWithPropsPlain: cssWithPropsPlain$1,
createAsyncComponent: componentAsync
};
var src = snabbomReactComponents;

export default src;
export { h_1 as h, css_1 as css, lazy_1$1 as lazy, patch_1 as patch, styled_1$1 as styled, cssWithProps_1 as cssWithProps, cssWithPropsPlain_1 as cssWithPropsPlain, createAsyncComponent_1 as createAsyncComponent };
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To render siplest **SRC** component, we will use Snabbdom vnode, eg. paragraph.
Find more about `createComponent` function [here](#createComponent).

```javascript
import createComponent, { h, patch } from 'snabbdom-react-components'
import { createComponent, h, patch } from 'snabbdom-react-components'

const myComponent = createComponent({
render: () => {
Expand All @@ -45,7 +45,7 @@ One of the biggers benefits for using **SRC** is the React Based lifecycle mecha
In this example, we will render a list of all the users, but for the time we don't have them, we will render loading message

```javascript
import createComponent, { h } from 'snabbdom-react-components'
import { createComponent, h } from 'snabbdom-react-components'

const myComponent = createComponent({
state: {
Expand All @@ -72,7 +72,7 @@ const myComponent = createComponent({
Along with component builder, **SRC** have build in [Styled Components](https://styled-components.com) builder we all love from React. It is not as powerfull yet. Yet 😇

```javascript
import createComponent, { styled } from 'snabbdom-react-components'
import { createComponent, styled } from 'snabbdom-react-components'

const Button = styled.button`
color: ${props => !props.toggled ? '#fff' : '#4f4f4f'};
Expand Down Expand Up @@ -104,7 +104,7 @@ const myComponent = createComponent({
Redux for good become one of the best state managing liblaries. Based on that, **SRC** has build-in simpler and easier, but powerfull reducer functionality

```javascript
import createComponent, { styled } from 'snabbdom-react-components'
import { createComponent, styled } from 'snabbdom-react-components'

const Info = styled.div`
color: #4f4f4f;
Expand Down Expand Up @@ -241,7 +241,7 @@ This is the more advanced version of simple `createComponent` method. **Is is hi
The main diffrence between `createComponent` function is that this component by default is returned as `async` function throught the `lazy` helper. That's allow you to organize your code even more! Look at example. We will get the list of all the users and display as a list:

```javascript
import createComponent, { styled, createAsyncComponent } from 'snabbdom-react-components'
import { createComponent, styled, createAsyncComponent } from 'snabbdom-react-components'

const Info = styled.div`
color: #4f4f4f;
Expand Down
21 changes: 12 additions & 9 deletions src.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ const createComponent = require('./modules/component.js')
const createAsyncComponent = require('./modules/component-async.js')
const { styled, css, cssWithProps, cssWithPropsPlain } = require('./modules/styled')

module.exports = createComponent
const snabbomReactComponents = {
h: h,
css: css,
lazy: lazy,
patch: patch,
styled: styled,
cssWithProps: cssWithProps,
createComponent: createComponent,
cssWithPropsPlain: cssWithPropsPlain,
createAsyncComponent: createAsyncComponent
}

module.exports.h = h
module.exports.css = css
module.exports.lazy = lazy
module.exports.patch = patch
module.exports.styled = styled
module.exports.cssWithProps = cssWithProps
module.exports.cssWithPropsPlain = cssWithPropsPlain
module.exports.createAsyncComponent = createAsyncComponent
module.exports = snabbomReactComponents

0 comments on commit 46c36fb

Please sign in to comment.