reason-react
Advanced tools
Comparing version 0.9.1 to 0.9.2
@@ -255,3 +255,3 @@ # 0.9.0 (05/2020) | ||
**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)! =) | ||
**Major update**, but again with **no** breaking changes, and _again_ with a convenience [migration script](https://github.com/reasonml/reason-react/blob/main/migrate/from02xTo024.js)! =) | ||
@@ -258,0 +258,0 @@ The big change in this release is the deprecation of `statefulComponent` and `statefulComponentWithRetainedProps`. `statelessComponent` stays the same. |
{ | ||
"name": "reason-react", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "React bindings for Reason", | ||
@@ -17,3 +17,4 @@ "files": [ | ||
"test": "jest", | ||
"format": "find ./src -iname '*.re' | xargs bsrefmt --in-place && find ./src -iname '*.rei' | xargs bsrefmt -i true --in-place" | ||
"format": "find ./src -iname '*.re' | xargs bsrefmt --in-place && find ./src -iname '*.rei' | xargs bsrefmt -i true --in-place", | ||
"init": "opam switch create . 4.06.1 --deps-only -y" | ||
}, | ||
@@ -20,0 +21,0 @@ "keywords": [ |
109
README.md
@@ -1,106 +0,11 @@ | ||
# [ReasonReact](https://reasonml.github.io/reason-react/) - ReasonML / BuckleScript bindings for React.js | ||
# [ReasonReact](https://reasonml.github.io/reason-react/) | ||
[![npm version](https://badge.fury.io/js/reason-react.svg)](https://www.npmjs.com/package/reason-react) | ||
![npm](https://img.shields.io/npm/dt/reason-react) | ||
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) | ||
![contributors](https://img.shields.io/github/contributors/reasonml/reason-react) | ||
[![discord](https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue)](https://discord.gg/reasonml) | ||
[![twitter](https://img.shields.io/twitter/follow/reasonml?style=social)](https://twitter.com/reasonml) | ||
**Note**: ReasonReact now lives at [@rescript/react](https://github.com/rescript-lang/rescript-react), which maintains full compatiblity with the latest ReasonReact, excluding the long-deprecated old modules aliases (such as `ReactDOMRe`, in favor of `ReactDOM`) that we've taken the occasion to finally remove. Migration notes [here](https://rescript-lang.org/docs/react/latest/migrate-from-reason-react). | ||
ReasonReact is a safer, simpler way to build React components. You get a great type system with an even better developer experience. Why choose ReasonReact? Read more [here](https://reasonml.github.io/reason-react/docs/en/what-and-why) | ||
Tldr: you can just change your `package.json`'s `"reason-react"` dependency to `"@rescript/react"`. For transitive dependencies upgrade truoble, please voice your feedback on our [forum](http://forum.rescript-lang.org) and on the [migration issue](https://github.com/rescript-lang/rescript-react/issues/11). Thanks! | ||
ReasonReact is just React.js under the hood. This makes it super easy to integrate with your current Next.js, Create React App, JavaScript, Flowtype or TypeScript project. Learn more about getting started [here](https://reasonml.github.io/reason-react/docs/en/installation#adding-reason-to-an-existing-reactjs-project-create-react-app-nextjs-etc) | ||
Future updates happens at `rescript-react` as a continuation of ReasonReact, by the same people. | ||
> Watch Ricky Vetter's Reason Conf talk, ["Why React is Just Better in Reason"](https://www.youtube.com/watch?v=i9Kr9wuz24g) to learn more about how Facebook & Messenger are using ReasonReact | ||
> Watch Jordan Walke's Reason Conf talk, ["React to the Future"](https://www.youtube.com/watch?v=5fG_lyNuEAw) to learn more about the future of ReasonML and React | ||
## Example | ||
```reason | ||
/* Greeting.re */ | ||
[@react.component] | ||
let make = (~name) => <h1> {React.string("Hello " ++ name)} </h1> | ||
``` | ||
See all of our examples [here](https://reasonml.github.io/reason-react/docs/en/simple). For a full application, check out [reason-react-hacker-news](https://github.com/reasonml-community/reason-react-hacker-news). | ||
## Getting Started | ||
[BuckleScript](http://bucklescript.github.io/) is how your ReasonML code gets compiled to Javascript. Every project that uses BuckleScript will have a `bsconfig.json` file (the same way you'd have tsconfig.json in a Typescript project) with project specific settings. | ||
You can install BuckleScript globally or keep it project specific by adding it as a `devDependency`: | ||
```sh | ||
yarn global add bs-platform | ||
# or npm | ||
npm install --global bs-platform | ||
``` | ||
If you install BuckleScript globally, you can quickly generate a ReasonReact project template (similar to `create-react-app`): | ||
```sh | ||
bsb -init my-react-app -theme react-hooks | ||
cd my-react-app && npm install && npm start | ||
# in another tab | ||
npm run server | ||
``` | ||
If you're interested in adding ReasonReact to your current project, it's a simple 2 step process: | ||
``` | ||
yarn add bs-platform --dev --exact | ||
# or npm | ||
npm install bs-platform -D -S | ||
``` | ||
Add the appropriate script tags to package.json: | ||
```json | ||
"scripts": { | ||
"re:build": "bsb -make-world -clean-world", | ||
"re:watch": "bsb -make-world -clean-world -w" | ||
} | ||
``` | ||
Copy the `bsconfig.json` file from our docs located [here](https://reasonml.github.io/reason-react/docs/en/installation#adding-reason-to-an-existing-reactjs-project-create-react-app-nextjs-etc) | ||
Then add some files somewhere (don't forget to change `bsconfig.json`, if needed). | ||
## Using Your Favorite Javascript Libraries | ||
The same way that TypeScript has `type annotations`, we have `bindings`. Bindings are libraries that allow you to import a popular project (like lodash) or to import your own local file. ReasonReact is in fact an example of a binding! | ||
## Documentation | ||
See [https://reasonml.github.io/reason-react](https://reasonml.github.io/reason-react) | ||
## Contribute | ||
We welcome all contributors! Anything from docs to issues to pull requests. Please help us :smile: | ||
```sh | ||
git clone https://github.com/reasonml/reason-react.git | ||
cd reason-react | ||
npm install | ||
npm start | ||
``` | ||
See the README inside `src` for more info! | ||
## Editor Support | ||
Looking for syntax highlighting for your favorite editor? Check out [ReasonML Editor Plugins](https://reasonml.github.io/docs/en/editor-plugins) | ||
## Friends of ReasonReact | ||
- [genType](https://github.com/cristianoc/genType) - genType automatically generates bindings for your TypeScript / vanilla JS code. | ||
- [reason-react-native](https://github.com/reason-react-native/reason-react-native) - ReasonML / Bucklescript bindings for React Native. Allows you to use Reason to build an iOS, Android or Web app! | ||
- [reasonml.org](https://reasonml.org/) - An effort by the Reason Association to improve documentation for ReasonML & BuckleScript | ||
- [redex.github.io](https://redex.github.io/) - Find bindings for your favorite libraries here | ||
- [ReasonTown Podcast](https://anchor.fm/reason-town) - ReasonML Podcast | ||
- [ReasonConf Youtube](https://www.youtube.com/channel/UCtFP_Hn5nIbZY4Xi47qfHhw/videos) Reason Conf on Youtube | ||
Likewise, the old [reason-react docs](https://reasonml.github.io/reason-react/) are kept alive for historical purposes, with its continuation at [rescript-react docs](https://rescript-lang.org/docs/react/latest/introduction). | ||
More context on the move [here](https://rescript-lang.org/blog/bucklescript-is-rebranding). |
@@ -18,2 +18,4 @@ 'use strict'; | ||
var Drag = { }; | ||
var Pointer = { }; | ||
@@ -40,2 +42,3 @@ | ||
exports.Composition = Composition; | ||
exports.Drag = Drag; | ||
exports.Keyboard = Keyboard; | ||
@@ -42,0 +45,0 @@ exports.Focus = Focus; |
@@ -5,6 +5,14 @@ Welcome to the source of ReasonReact! | ||
- `ReactDOMRe`: bindings to ReactDOM. | ||
- `ReactDOMServerRe`: bindings to ReactDOMServer. | ||
## Bindings | ||
- `React`: bindings to React. | ||
- `ReactDOM`: bindings to ReactDOM. | ||
- `ReactDOMServer`: bindings to ReactDOMServer. | ||
- `ReactEvent`: 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). | ||
- `ReactDOMStyle`: bindings to create `style` objects. | ||
## Extra | ||
- `ReactTestUtils`: helpers for testing your components | ||
- `ReasonReactErrorBoundary`: component to catch errors within your component tree | ||
- `ReasonReactRouter`: a simple, yet fully featured router with minimal memory allocations |
@@ -15,9 +15,4 @@ 'use strict'; | ||
function path(param) { | ||
var $$window = typeof window === "undefined" ? undefined : window; | ||
if ($$window === undefined) { | ||
return /* [] */0; | ||
} | ||
var raw = $$window.location.pathname; | ||
switch (raw) { | ||
function pathParse(str) { | ||
switch (str) { | ||
case "" : | ||
@@ -27,6 +22,10 @@ case "/" : | ||
default: | ||
var raw$1 = raw.slice(1); | ||
var match = raw$1[raw$1.length - 1 | 0]; | ||
var raw$2 = match === "/" ? raw$1.slice(0, -1) : raw$1; | ||
var a = raw$2.split("/"); | ||
var raw = str.slice(1); | ||
var match = raw[raw.length - 1 | 0]; | ||
var raw$1 = match === "/" ? raw.slice(0, -1) : raw; | ||
var match$1 = raw$1.split("?", 2); | ||
var raw$2 = match$1.length !== 2 ? raw$1 : match$1[0]; | ||
var a = raw$2.split("/").filter((function (item) { | ||
return item.length !== 0; | ||
})); | ||
var _i = a.length - 1 | 0; | ||
@@ -50,2 +49,13 @@ var _res = /* [] */0; | ||
function path(serverUrlString, param) { | ||
var match = typeof window === "undefined" ? undefined : window; | ||
if (serverUrlString !== undefined) { | ||
return pathParse(serverUrlString); | ||
} else if (match !== undefined) { | ||
return pathParse(match.location.pathname); | ||
} else { | ||
return /* [] */0; | ||
} | ||
} | ||
function hash(param) { | ||
@@ -66,9 +76,4 @@ var $$window = typeof window === "undefined" ? undefined : window; | ||
function search(param) { | ||
var $$window = typeof window === "undefined" ? undefined : window; | ||
if ($$window === undefined) { | ||
return ""; | ||
} | ||
var raw = $$window.location.search; | ||
switch (raw) { | ||
function searchParse(str) { | ||
switch (str) { | ||
case "" : | ||
@@ -78,6 +83,22 @@ case "?" : | ||
default: | ||
return raw.slice(1); | ||
var match = str.split("?", 2); | ||
if (match.length !== 2) { | ||
return ""; | ||
} else { | ||
return match[1]; | ||
} | ||
} | ||
} | ||
function search(serverUrlString, param) { | ||
var match = typeof window === "undefined" ? undefined : window; | ||
if (serverUrlString !== undefined) { | ||
return searchParse(serverUrlString); | ||
} else if (match !== undefined) { | ||
return searchParse(match.location.search); | ||
} else { | ||
return ""; | ||
} | ||
} | ||
function push(path) { | ||
@@ -134,7 +155,7 @@ var match = typeof history === "undefined" ? undefined : history; | ||
function url(param) { | ||
function url(serverUrlString, param) { | ||
return { | ||
path: path(undefined), | ||
path: path(serverUrlString, undefined), | ||
hash: hash(undefined), | ||
search: search(undefined) | ||
search: search(serverUrlString, undefined) | ||
}; | ||
@@ -151,3 +172,3 @@ } | ||
var watcherID = function (param) { | ||
return Curry._1(callback, url(undefined)); | ||
return Curry._1(callback, url(undefined, undefined)); | ||
}; | ||
@@ -172,3 +193,3 @@ $$window.addEventListener("popstate", watcherID); | ||
} else { | ||
return url(undefined); | ||
return url(undefined, undefined); | ||
} | ||
@@ -184,3 +205,3 @@ })); | ||
})); | ||
var newUrl = url(undefined); | ||
var newUrl = url(undefined, undefined); | ||
if (urlNotEqual(newUrl, url$1)) { | ||
@@ -187,0 +208,0 @@ Curry._1(setUrl, (function (param) { |
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
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
542681
56
6219
12
2