Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reason-react

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reason-react - npm Package Compare versions

Comparing version 0.2.4 to 0.3.0

circle.yml

3

bsconfig.json

@@ -8,3 +8,4 @@ /* This is the BuckleScript configuration file. Note that this is a comment;

"sources": "src",
"bsc-flags": ["-w", "-30"],
"refmt": 3,
"bsc-flags": ["-bs-no-version-header"]
}

@@ -10,4 +10,5 @@ Like HISTORY.md, but for planned future versions and subject to change. The vocabulary here uses the past tense, to pretend that the versions are already published.

# 0.3.0 (breaking)
# 0.3.1
- Preparation for namespace
- Set lifecycles to null when they do nothing. React skips over lifecycles that are set to null, we currently have wrappers around all of them, so things like didMount are enqueued for *every* component.

@@ -14,0 +15,0 @@ - `ReactDOMRe.createElement` (usually used through the JSX `<div> foo </div>`) has a new implementation that fixes an inadvertent children key warning in the previous version.

@@ -0,12 +1,30 @@

# 0.3.0
Technically a breaking change, but just because of the removal of a few deprecated things. **No migration script this time**; since the few breaking changes you encounter (if any) should have be spotted by the type system and fixed in a few secs anyway.
Improvements:
- **Loosen `children`'s restriction**. This unlocks _huge_ potentials. See the blog post!
- Fix a bug where side effects inside side effects were skipped (#98).
- React 16 support.
- All files upper-cased. This follows the [new community idiom](https://reasonml.github.io/guide/meta/project-structure#file-casing). Technically an internal change; doesn't affect your usage of ReasonReact.
- More DOM props. There are like, more DOM props added per year than the number of releases we have. What a funny time to be alive.
Breaking Changes:
- **`ref` is now typed as `Js.nullable(Dom.element)`, not `Js.null(Dom.element)`**. `Js.nullable` is the new community idiom from BuckleScript. Go through your codebase and change your `state.myRef := Js.Null.to_opt(theRef)` into `state.myRef := Js.Nullable.to_opt(theRef)`. We suggest you to also remove all mentions of `Js.null`, `Js.undefined`, `Js.Null` and `Js.Undefined`. `Js.Nullable` checks for both JavaScript `null` and `undefined`, thus making the JS interop more robust. In the past, people type certain values (especially js objects fields) as e.g. `null` and forget they can be `undefined`.
- DOM components (`ReactDOMRe`)'s `open`, `end` and `in` attributes are now changed to `_open`, `_end` and `_in` to avoid using reserved keywords. This is only breaking if you're using these attributes _and_ are on the old syntax.
- Remove old stuff: `enqueue`, `statefulComponent` and `self.update`. These have long been deprecated.
# 0.2.4
**Major update**, but again with **no** breaking changes, and _again_ with a convenience [migration script](https://github.com/reasonml/reason-react/blob/master/migrateFrom02xTo024.js)! =)
**Major update**, but again with **no** breaking changes, and _again_ with a convenience [migration script](https://github.com/reasonml/reason-react/blob/master/migrate/from02xTo024.js)! =)
The big change in this release is the deprecation of `statefulComponent` and `statefulComponentWithRetainedProps`.
The big change in this release is the deprecation of `statefulComponent` and `statefulComponentWithRetainedProps`. `statelessComponent` stays the same.
## Prerequisites
**Please first read the [blog post](https://reasonml.github.io/reason-react/reason-react/docs/blog.html#reducers-are-here)**.
**Please first read the [blog post](https://reasonml.github.io/reason-react/blog.html#reducers-are-here)**.
**After** reading this migration guide, use the migratio script (or not) like so: `node node_modules/reason-react/migrateFrom02xTo024.js myReasonFile.re`.
**After** reading this migration guide, use the migration script (or not) like so: `node node_modules/reason-react/migrate/from02xTo024.js myReasonFile.re`.

@@ -28,3 +46,3 @@ ## Migrate From StatefulComponent to ReducerComponent

switch action {
| Click => ReasonReact.Update {...state, foo: bar}
| Click => ReasonReact.Update {...state, foo: bar}
}

@@ -35,14 +53,23 @@ ```

The relevant section on actions, reducers and the new update additions are [in the main docs](https://reasonml.github.io/reason-react/docs/index.html#reason-react-component-creation-state-actions-reducer).
The relevant section on actions, reducers and the new update additions are [in the main docs](https://reasonml.github.io/reason-react/#reason-react-component-creation-state-actions-reducer).
**If everything goes alright, we will be deprecating `statefulComponent` in the future**
## InstanceVars/React Ref Usage Changed
Before, we used to recommend using `ReasonReact.SilentUpdate` to deal with ReactJS' instance variables pattern (e.g. attaching properties onto the component class itself, like timer IDs, refs, etc.). Now we've moved to using a Reason `ref` cell (not the React ref, the [mutative Reason `ref`](https://reasonml.github.io/guide/language/imperative-loops)). See the updated [instance variables section](https://reasonml.github.io/reason-react/#reason-react-component-creation-instance-variables).
Before, we used to recommend using `ReasonReact.SilentUpdate` to deal with ReactJS' instance variables pattern (e.g. attaching properties onto the component class itself, like timer IDs, subscriptions, refs, etc.). Now we've moved to using a Reason `ref` cell (not the React ref, the [mutative Reason `ref`](https://reasonml.github.io/guide/language/mutation)). See the updated [instance variables section](https://reasonml.github.io/reason-react/#reason-react-component-creation-instance-variables).
The new recommendation also solves a corner-case bug with assigning more than one refs in the render.
## LifeCycle
## LifeCycle: Future `didMount` and `willReceiveProps` Signature Change
The future ReactJS Fiber in ReasonReact won't work well with lifecycle events that return the new state (aka `ReasonReact.Update {...state, foo: bar}`). Please return `ReasonReact.NoUpdate`. If you really need to trigger a state change, before the return, use a `self.reduce (fun () => Bar) ()`, aka immediately apply a reduce.
The future ReactJS Fiber in ReasonReact won't work well with lifecycle events that return the new state, aka:
- `didMount`'s `ReasonReact.Update {...state, foo: bar}`
- `willReceiveProps` `state`.
Please return `ReasonReact.NoUpdate` for the former (can't do much for the latter, `willReceiveProps`, for now. Keep it as it is). If you really need to trigger a state change, before the return, use a `self.reduce (fun () => Bar) ()`, aka immediately apply a reduce.
**We will make all lifecycles return `unit` in the future; it'll be an easy codemod to change `ReasonReact.NoUpdate` to nothing**.
## Miscellaneous Changes

@@ -180,3 +207,3 @@

let createElement name::(name: string) age::(age: option int)=? =>
ReactRe.wrapPropsShamelessly myJSReactClass {"name": name, "age": Js.Null_undefined.from_opt age};
ReactRe.wrapPropsShamelessly myJSReactClass {"name": name, "age": Js.Nullable.from_opt age};
```

@@ -192,3 +219,3 @@

reactClass::myJSReactClass
props::{"name": name, "age": Js.Null_undefined.from_opt age}
props::{"name": name, "age": Js.Nullable.from_opt age}
children;

@@ -209,3 +236,3 @@ ```

::component
(fun jsProps => make name::jsProps##name age::?(Js.Null_undefined.to_opt jsProps##age) [||]);
(fun jsProps => make name::jsProps##name age::?(Js.Nullable.to_opt jsProps##age) [||]);
```

@@ -212,0 +239,0 @@

{
"name": "reason-react",
"version": "0.2.4",
"version": "0.3.0",
"description": "",

@@ -20,8 +20,8 @@ "main": "index.js",

"devDependencies": {
"bs-platform": "^1.8.2"
"bs-platform": "^2.0.0"
},
"dependencies": {
"react": ">=15.0.0",
"react-dom": ">=15.0.0"
"react": ">=15.0.0 || >=16.0.0",
"react-dom": ">=15.0.0 || >=16.0.0"
}
}

@@ -5,6 +5,6 @@ Welcome to the source of ReasonReact!

- `reactDOMRe`: bindings to ReactDOM.
- `reactDOMServerRe`: bindings to ReactDOMServer.
- `reactEventRe`: bindings to React's custom events system.
- `reasonReact`: core React bindings.
- `reasonReactOptimizedCreateClass`: our reasonReact component initialization uses React's createClass under the hood. This file's a tweaked version of it, with all the dependencies, warnings and invariants commented out (we don't need any of them anymore! Our types obsoleted them =D).
- `ReactDOMRe`: bindings to ReactDOM.
- `ReactDOMServerRe`: bindings to ReactDOMServer.
- `ReactEventRe`: bindings to React's custom events system.
- `ReasonReact`: core React bindings.
- `ReasonReactOptimizedCreateClass`: our reasonReact component initialization uses React's createClass under the hood. This file's a tweaked version of it, with all the dependencies, warnings and invariants commented out (we don't need any of them anymore! Our types obsoleted them =D).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc