Socket
Socket
Sign inDemoInstall

react-router

Package Overview
Dependencies
Maintainers
2
Versions
518
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router - npm Package Compare versions

Comparing version 3.2.1 to 3.2.2

13

docs/API.md

@@ -138,2 +138,5 @@ # React Router 3 API Reference

##### `innerRef`
Allows access to the underlying `ref` of the component.
##### *others*

@@ -157,2 +160,7 @@ You can also pass props you'd like to be on the `<a>` such as a `title`, `id`, `className`, etc.

<Link to="/users" style={{color: 'white'}} activeStyle={{color: 'red'}}>Users</Link>
const refCallback = node => {
// `node` refers to the mounted DOM element or null when unmounted
}
<Link to="/" innerRef={refCallback} />
```

@@ -343,4 +351,6 @@

##### `getComponent(nextState, callback)`
Same as `component` but asynchronous, useful for code-splitting.
Same as `component` but asynchronous, useful for code-splitting.
You can pass a Promise, in which case you should not use the `callback` function and instead use `resolve` like you normally would. You can also pass an async function, which is a Promise under the hood, and just `return` like normal. Any thrown exception will report an error to the router.
###### `callback` signature

@@ -356,2 +366,3 @@ `cb(err, component)`

##### `getComponents(nextState, callback)`

@@ -358,0 +369,0 @@ Same as `components` but asynchronous, useful for

4

es/InternalPropTypes.js

@@ -1,2 +0,2 @@

import { func, object, arrayOf, oneOfType, element, shape, string } from 'prop-types';
import { func, object, arrayOf, oneOfType, element, shape, elementType } from 'prop-types';

@@ -16,5 +16,5 @@ export function falsy(props, propName, componentName) {

export var component = oneOfType([func, string]);
export var component = elementType;
export var components = oneOfType([component, object]);
export var route = oneOfType([object, element]);
export var routes = oneOfType([route, arrayOf(route)]);

@@ -59,3 +59,4 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

onClick: func,
target: string
target: string,
innerRef: oneOfType([string, func])
},

@@ -94,3 +95,4 @@

onlyActiveOnIndex = _props.onlyActiveOnIndex,
props = _objectWithoutProperties(_props, ['to', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex']);
innerRef = _props.innerRef,
props = _objectWithoutProperties(_props, ['to', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex', 'innerRef']);

@@ -106,3 +108,3 @@ // Ignore if rendered outside the context of router to simplify unit testing.

if (!to) {
return React.createElement('a', props);
return React.createElement('a', _extends({}, props, { ref: innerRef }));
}

@@ -128,3 +130,3 @@

return React.createElement('a', _extends({}, props, { onClick: this.handleClick }));
return React.createElement('a', _extends({}, props, { onClick: this.handleClick, ref: innerRef }));
}

@@ -131,0 +133,0 @@ });

@@ -7,2 +7,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

import React from 'react';
import { isValidElementType } from 'react-is';
import createReactClass from 'create-react-class';

@@ -87,3 +88,5 @@ import { array, func, object } from 'prop-types';

if ((typeof components === 'undefined' ? 'undefined' : _typeof(components)) === 'object') {
// Handle components is object for { [name]: component } but not valid element
// type of react, such as React.memo, React.lazy and so on.
if ((typeof components === 'undefined' ? 'undefined' : _typeof(components)) === 'object' && !isValidElementType(components)) {
var elements = {};

@@ -90,0 +93,0 @@

@@ -22,5 +22,5 @@ 'use strict';

var component = exports.component = (0, _propTypes.oneOfType)([_propTypes.func, _propTypes.string]);
var component = exports.component = _propTypes.elementType;
var components = exports.components = (0, _propTypes.oneOfType)([component, _propTypes.object]);
var route = exports.route = (0, _propTypes.oneOfType)([_propTypes.object, _propTypes.element]);
var routes = exports.routes = (0, _propTypes.oneOfType)([route, (0, _propTypes.arrayOf)(route)]);

@@ -76,3 +76,4 @@ 'use strict';

onClick: _propTypes.func,
target: _propTypes.string
target: _propTypes.string,
innerRef: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.func])
},

@@ -111,3 +112,4 @@

onlyActiveOnIndex = _props.onlyActiveOnIndex,
props = _objectWithoutProperties(_props, ['to', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex']);
innerRef = _props.innerRef,
props = _objectWithoutProperties(_props, ['to', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex', 'innerRef']);

@@ -123,3 +125,3 @@ // Ignore if rendered outside the context of router to simplify unit testing.

if (!to) {
return _react2.default.createElement('a', props);
return _react2.default.createElement('a', _extends({}, props, { ref: innerRef }));
}

@@ -145,3 +147,3 @@

return _react2.default.createElement('a', _extends({}, props, { onClick: this.handleClick }));
return _react2.default.createElement('a', _extends({}, props, { onClick: this.handleClick, ref: innerRef }));
}

@@ -148,0 +150,0 @@ });

@@ -17,2 +17,4 @@ 'use strict';

var _reactIs = require('react-is');
var _createReactClass = require('create-react-class');

@@ -106,3 +108,5 @@

if ((typeof components === 'undefined' ? 'undefined' : _typeof(components)) === 'object') {
// Handle components is object for { [name]: component } but not valid element
// type of react, such as React.memo, React.lazy and so on.
if ((typeof components === 'undefined' ? 'undefined' : _typeof(components)) === 'object' && !(0, _reactIs.isValidElementType)(components)) {
var elements = {};

@@ -109,0 +113,0 @@

{
"name": "react-router",
"version": "3.2.1",
"version": "3.2.2",
"description": "A complete routing library for React",

@@ -41,3 +41,4 @@ "files": [

"loose-envify": "^1.2.0",
"prop-types": "^15.5.6",
"prop-types": "^15.7.2",
"react-is": "^16.8.6",
"warning": "^3.0.0"

@@ -72,3 +73,3 @@ },

"gzip-size": "^4.1.0",
"karma": "^2.0.0",
"karma": "^4.1.0",
"karma-browserstack-launcher": "^1.0.1",

@@ -84,5 +85,5 @@ "karma-chrome-launcher": "^2.0.0",

"qs": "^6.2.1",
"react": "^16.0.0-rc",
"react": "^16.8.6",
"react-addons-css-transition-group": "^15.6.0",
"react-dom": "^16.0.0-rc",
"react-dom": "^16.8.6",
"rimraf": "^2.5.4",

@@ -89,0 +90,0 @@ "style-loader": "^0.16.1",

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