@machinemetrics/mm-react-tools 2.2.0-dev → 3.0.1-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,15 +6,23 @@ Components, hooks, and helper functions for writing React apps using MachineMetr
6
6
 
7
7
  ## Table of Contents
8
8
 
9
+ - [Upgrading to 3.x] (#upgrading-to-3.x)
9
10
  - [Install](#install)
10
11
  - [Getting Started](#getting-started)
11
12
  - [Client ID and Secret](#client-id-and-secret)
12
13
  - [License](#license)
13
14
 
15
+ ## Upgrading to 3.x
16
+
17
+ When upgrading to 3.x or newer, there are a few breaking changes that need to be addressed.
18
+
19
+ - The `domain` property passed to `MMProvider` is no longer used so it can be removed. This information is inferred from the URL being loaded.
20
+ - If you pass `<Route>` components to `MMProvider` either directly or in some level more deeply nested within your application, it must be contained within a `<Routes>` component.
21
+
14
22
  ## Install
15
23
 
16
24
  ```bash
17
- yarn add mm-react-tools
25
+ npm install @machinemetrics/mm-react-tools
18
26
  ```
19
27
 
20
28
  ## Peer Dependencies
@@ -22,7 +30,7 @@ yarn add mm-react-tools
22
30
  Due to how Apollo, React, and other libraries work, there are some additional dependencies that you'll need to include in your project:
23
31
 
24
32
  ```bash
25
- yarn add react react-router-dom styled-components @apollo/client subscriptions-transport-ws graphql
33
+ npm install react react-router-dom styled-components @apollo/client
26
34
  ```
27
35
 
28
36
  ## Getting Started
@@ -32,12 +40,11 @@ Wrap your application in the `MMProvider` to wire up everything necessary to aut
32
40
  ```jsx
33
41
  import React from 'react';
34
42
  import ReactDOM from 'react-dom';
35
- import { MMProvider } from 'mm-react-tools';
43
+ import { MMProvider } from '@machinemetrics/mm-react-tools';
36
44
  import App from './App';
37
45
 
38
46
  ReactDOM.render(
39
47
  <MMProvider
40
- domain={process.env.REACT_APP_URL}
41
48
  clientId={process.env.REACT_APP_CLIENT_ID}
42
49
  clientSecret={process.env.REACT_APP_CLIENT_SECRET}
43
50
  releaseStage={process.env.REACT_APP_RELEASE_STAGE}
@@ -56,17 +63,19 @@ Use the `ProtectedRoute` to kick off the login flow.
56
63
  ```jsx
57
64
  // App.js
58
65
  import React from 'react';
59
- import { Route } from 'react-router-dom';
60
- import { PrivateLayout } from 'mm-react-tools';
66
+ import { Route, Routes } from 'react-router-dom';
67
+ import { PrivateLayout } from '@machinemetrics/mm-react-tools';
61
68
  import PublicPage from './PublicPage';
62
69
  import PrivatePage from './PrivatePage';
63
70
 
64
71
  function App() {
65
72
  return (
66
- <Route exact path='/public' element={<PublicPage />} />
67
- <Route element={<PrivateLayout />}>
68
- <Route path="/private" element={<PrivatePage />}>
69
- </Route>
73
+ <Routes>
74
+ <Route exact path='/public' element={<PublicPage />} />
75
+ <Route element={<PrivateLayout />}>
76
+ <Route path="/private" element={<PrivatePage />}>
77
+ </Route>
78
+ <Routes>
70
79
  );
71
80
  }
72
81