isomorfeus-react 16.6.1 → 16.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -1
- data/lib/react.rb +11 -2
- data/lib/react/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61b8f04576385edf701a851c23d7844a692112c4350fe2fd05863711c277529c
|
4
|
+
data.tar.gz: bacec1878a3881c084805101d070c8dce6c934803085172ec3b2fd516660224e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64d409626ef651aa300a38066514de2460a6f5232c4c7ca1ec8977fba314091f4a0690a12f302dfa1934d8eb7e3848f0398a9ee88d1f1eb805ebc113cea5b06e
|
7
|
+
data.tar.gz: 2f654f344ef6b82583aa51de25a33c55c526fa860d0e23635b69bb0997b99325d5e8a084989a66f0ba6bb2a888d416cde86358b5e08d6ee6286aa41ae959ce50
|
data/README.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
Develop React components for Opal Ruby along with very easy to use and advanced React-Redux Components.
|
4
4
|
|
5
|
+
## Chat
|
6
|
+
At our [Gitter Isomorfeus Lobby](http://gitter.im/isomorfeus/Lobby)
|
7
|
+
|
5
8
|
## Versioning
|
6
9
|
isomorfeus-react version follows the React version which features and API it implements.
|
7
10
|
Isomorfeus-react 16.5.x implements features and the API of React 16.6 and should be used with React 16.6
|
@@ -20,6 +23,21 @@ and to your client code add:
|
|
20
23
|
```ruby
|
21
24
|
require 'isomorfeus-react' # this will also require isomorfeus-redux
|
22
25
|
```
|
26
|
+
|
27
|
+
### Dependencies
|
28
|
+
|
29
|
+
For full functionality the following are required:
|
30
|
+
- [Opal ES6 import export](https://github.com/opal/opal/pull/1832)
|
31
|
+
- [Opal Webpack Loader](https://github.com/janbiedermann/opal-webpack-loader)
|
32
|
+
- [Opal Autoloader](https://github.com/janbiedermann/opal-autoloader)
|
33
|
+
|
34
|
+
For the Gemfile:
|
35
|
+
```ruby
|
36
|
+
gem 'opal', github: 'janbiedermann/opal', branch: 'es6_import_export'
|
37
|
+
gem 'opal-webpack-loader', '~> 0.3.7'
|
38
|
+
gem 'opal-autoloader', '~> 0.0.3'
|
39
|
+
```
|
40
|
+
|
23
41
|
## Usage
|
24
42
|
Because isomorfeus-react follows closely the React principles/implementation/API and Documentation, most things of the official React documentation
|
25
43
|
apply, but in the Ruby way, see:
|
@@ -136,7 +154,14 @@ end
|
|
136
154
|
This creates a native javascript components.
|
137
155
|
The file containing the creator must be explicitly required, because the automatic resolution of Javascript constant names
|
138
156
|
is not done by opal-autoloader.
|
139
|
-
|
157
|
+
|
158
|
+
A custom memo props function can be utilized when using React.memo directly with a function component and a block for checking the props:
|
159
|
+
```ruby
|
160
|
+
React.memo(`MyComponent`) do |prev_props, next_props|
|
161
|
+
prev_props.var != next_props.var
|
162
|
+
end
|
163
|
+
```
|
164
|
+
|
140
165
|
A Function Component can then be used in other Components:
|
141
166
|
```ruby
|
142
167
|
class MyComponent < React::PureComponent::Base
|
@@ -620,6 +645,17 @@ Overwriting should_component_update is also not supported.
|
|
620
645
|
**Data flow of a LucidComponent within a LucidApp:**
|
621
646
|
![LucidComponent within a LucidApp Data Flow](https://raw.githubusercontent.com/isomorfeus/isomorfeus-react/master/images/data_flow_lucid_component.png)
|
622
647
|
|
648
|
+
### Code Splitting with Suspense (doc is wip)
|
649
|
+
|
650
|
+
React.lazy is availalable and so is the Suspense Component, in a render block:
|
651
|
+
```ruby
|
652
|
+
render do
|
653
|
+
Suspense do
|
654
|
+
MyComponent()
|
655
|
+
end
|
656
|
+
end
|
657
|
+
```
|
658
|
+
|
623
659
|
### Development Tools
|
624
660
|
The React Developer Tools allow for analyzing, debugging and profiling components. A very helpful toolset and working very nice with isomorfeus-react:
|
625
661
|
https://github.com/facebook/react-devtools
|
data/lib/react.rb
CHANGED
@@ -149,7 +149,16 @@ module React
|
|
149
149
|
`React.lazy(import_statement_function)`
|
150
150
|
end
|
151
151
|
|
152
|
-
def self.memo(function_component)
|
153
|
-
|
152
|
+
def self.memo(function_component, &block)
|
153
|
+
if block_given?
|
154
|
+
%x{
|
155
|
+
var fun = function(prev_props, next_props) {
|
156
|
+
return #{block.call(::React::Component::Props.new(prev_props), ::React::Component::Props.new(next_props))};
|
157
|
+
}
|
158
|
+
return React.memo(function_component, fun);
|
159
|
+
}
|
160
|
+
else
|
161
|
+
`React.memo(function_component)`
|
162
|
+
end
|
154
163
|
end
|
155
164
|
end
|
data/lib/react/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-react
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 16.6.
|
4
|
+
version: 16.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|