You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://gitter.im/mbasso/react-decoration?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
> A collection of @decorators for React Components
10
15
11
16
- - -
12
17
13
-
**Attention - In order to use react-decoration you have to use babel 5 or use [this](https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy) plugin for babel 6. Check [this](https://github.com/mbasso/react-decoration/blob/master/docs/Introduction.md) page for information.**
18
+
**Attention - In order to use react-decoration you have to use babel 5
@@ -22,11 +32,15 @@ You can install react-decoration using [npm](https://www.npmjs.com/package/react
22
32
npm install --save react-decoration
23
33
```
24
34
25
-
If you aren't using npm in your project, you can include reactDecoration using UMD build in the dist folder with `<script>` tag.
35
+
If you aren't using npm in your project, you can include
36
+
reactDecoration using UMD build in the dist folder with `<script>`
37
+
tag.
26
38
27
39
## Usage
28
40
29
-
Once you have installed react-decoration, supposing a CommonJS environment, you can import decorators in this way and immediately use them with no configuration.
41
+
Once you have installed react-decoration, supposing a CommonJS
42
+
environment, you can import decorators in this way and immediately use
43
+
them with no configuration.
30
44
31
45
```js
32
46
importReactfrom'react';
@@ -100,19 +114,30 @@ class SampleForm extends React.Component {
100
114
101
115
## Documentation
102
116
103
-
Visit [docs](https://github.com/mbasso/react-decoration/blob/master/docs) folder to find the complete list of decorators and their usage.
folder to find the complete list of decorators and their usage.
104
120
105
121
## Change Log
106
122
107
-
This project adheres to [Semantic Versioning](http://semver.org/).
108
-
Every release, along with the migration instructions, is documented on the Github [Releases](https://github.com/mbasso/react-decoration/releases) page.
123
+
This project adheres to [Semantic Versioning](http://semver.org/).
124
+
Every upstream release, along with the migration instructions, is
As we said in [README](https://github.com/mbasso/react-decoration/blob/master/README.md) file, in order to use [react-decoration](https://github.com/mbasso/react-decoration) you have to use babel 5 or [this](https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy) plugin for babel 6. This allows you to compile decorators in the right way, so you can use them.
4
-
Note that this is not an official babel plugin but, as we can see [here](http://babeljs.io/docs/plugins/transform-decorators/) this is the only way to parse decorators at the moment:
plugin for babel 6. This allows you to compile decorators in the right
10
+
way, so you can use them. Note that this is not an official babel
11
+
plugin but, as we can see
12
+
[here](http://babeljs.io/docs/plugins/transform-decorators/) this is
13
+
the only way to parse decorators at the moment:
5
14
6
-
> Decorators are disabled in Babel v6, pending a proposal update – see [babel/babel#2645](https://github.com/babel/babel/issues/2645).
7
-
>
8
-
> Until Babel officially supports decorators again, you might want to try the third-party [transform-decorators-legacy](https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy) plugin, or use Babel v5.
15
+
> Decorators are disabled in Babel v6, pending a proposal update – see
> If you are including your plugins manually and using `transform-class-properties`, make sure that `transform-decorators-legacy` comes *before*`transform-class-properties`.
28
-
>
42
+
>
29
43
>```js
30
44
> /// WRONG
31
-
>
45
+
>
32
46
>"plugins": [
33
47
>"transform-class-properties",
34
48
>"transform-decorators-legacy"
35
49
> ]
36
-
>
50
+
>
37
51
> // RIGHT
38
-
>
52
+
>
39
53
>"plugins": [
40
54
>"transform-decorators-legacy",
41
55
>"transform-class-properties"
42
56
> ]
43
57
>```
44
58
45
-
Subsequently to this, you should read [this](https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy#best-effort)
46
-
specification. In this way you will be able to avoid a series of problems that can take a lot of time to resolve.
specification. In this way you will be able to avoid a series of
62
+
problems that can take a lot of time to resolve.
47
63
48
-
Please note that react-decoration does not include polyfill, so, if you want to support old browsers, you have to emulate `Object.setPrototypeOf` and `Object.assign`.
64
+
Please note that react-decoration does not include polyfill, so, if
65
+
you want to support old browsers, you have to emulate
66
+
`Object.setPrototypeOf` and `Object.assign`.
49
67
50
68
Consider also that decorators can be imported in 2 different ways:
51
69
@@ -56,4 +74,6 @@ import { throttle } from 'react-decoration';
56
74
import throttle from 'react-decoration/lib/decorators/functions/throttle';
57
75
```
58
76
59
-
Importing each decorator from its file is suggested, importing a single decorator from react-decoration, infact, causes the import of all modules, that increase the bundle size.
77
+
Importing each decorator from its file is suggested, importing a
78
+
single decorator from react-decoration, infact, causes the import of
0 commit comments