|
| 1 | +// Jest Snapshot v1, https://goo.gl/fbAQLP |
| 2 | + |
| 3 | +exports[`React hook transforms should support destructuring hooks from imports #2 1`] = ` |
| 4 | +"import React from \\"react\\"; |
| 5 | +const __reactCreateElement__ = React.createElement; |
| 6 | +const { |
| 7 | + useState |
| 8 | +} = React; |
| 9 | +export function MyComponent() { |
| 10 | + const _ref_0 = useState(0); |
| 11 | +
|
| 12 | + const setCounter = _ref_0[1]; |
| 13 | + const counter = _ref_0[0]; |
| 14 | + return __reactCreateElement__(\\"div\\", null, counter); |
| 15 | +}" |
| 16 | +`; |
| 17 | + |
| 18 | +exports[`React hook transforms should support destructuring hooks from imports #3 1`] = ` |
| 19 | +"import React from \\"react\\"; |
| 20 | +const __reactCreateElement__ = React.createElement; |
| 21 | +const useState = React.useState; |
| 22 | +export function MyComponent() { |
| 23 | + const _ref_0 = useState(0); |
| 24 | +
|
| 25 | + const setCounter = _ref_0[1]; |
| 26 | + const counter = _ref_0[0]; |
| 27 | + return __reactCreateElement__(\\"div\\", null, counter); |
| 28 | +}" |
| 29 | +`; |
| 30 | + |
| 31 | +exports[`React hook transforms should support destructuring hooks from imports #4 1`] = ` |
| 32 | +"import React from \\"react\\"; |
| 33 | +const __reactCreateElement__ = React.createElement; |
| 34 | +const foo = React.useState; |
| 35 | +export function MyComponent() { |
| 36 | + const _ref_0 = foo(0); |
| 37 | +
|
| 38 | + const setCounter = _ref_0[1]; |
| 39 | + const counter = _ref_0[0]; |
| 40 | + return __reactCreateElement__(\\"div\\", null, counter); |
| 41 | +}" |
| 42 | +`; |
| 43 | + |
| 44 | +exports[`React hook transforms should support destructuring hooks from imports #5 1`] = ` |
| 45 | +"import React from \\"react\\"; |
| 46 | +const __reactCreateElement__ = React.createElement; |
| 47 | +const { |
| 48 | + useState: foo |
| 49 | +} = React; |
| 50 | +export function MyComponent() { |
| 51 | + const _ref_0 = foo(0); |
| 52 | +
|
| 53 | + const setCounter = _ref_0[1]; |
| 54 | + const counter = _ref_0[0]; |
| 55 | + return __reactCreateElement__(\\"div\\", null, counter); |
| 56 | +}" |
| 57 | +`; |
| 58 | + |
| 59 | +exports[`React hook transforms should support destructuring hooks from imports 1`] = ` |
| 60 | +"import React from \\"react\\"; |
| 61 | +const __reactCreateElement__ = React.createElement; |
| 62 | +const { |
| 63 | + useState |
| 64 | +} = React; |
| 65 | +export function MyComponent() { |
| 66 | + const _ref_0 = useState(0); |
| 67 | +
|
| 68 | + const setCounter = _ref_0[1]; |
| 69 | + const counter = _ref_0[0]; |
| 70 | + return __reactCreateElement__(\\"div\\", null, counter); |
| 71 | +}" |
| 72 | +`; |
| 73 | + |
| 74 | +exports[`React hook transforms should support destructuring hooks from require calls 1`] = ` |
| 75 | +"const React = require(\\"react\\"); |
| 76 | +
|
| 77 | +const __reactCreateElement__ = React.createElement; |
| 78 | +const { |
| 79 | + useState |
| 80 | +} = React; |
| 81 | +export function MyComponent() { |
| 82 | + const _ref_0 = useState(0); |
| 83 | +
|
| 84 | + const setCounter = _ref_0[1]; |
| 85 | + const counter = _ref_0[0]; |
| 86 | + return __reactCreateElement__(\\"div\\", null, counter); |
| 87 | +}" |
| 88 | +`; |
| 89 | + |
| 90 | +exports[`React hook transforms should support hook CJS require with no default 1`] = ` |
| 91 | +"const { |
| 92 | + useState |
| 93 | +} = require(\\"react\\");" |
| 94 | +`; |
| 95 | + |
| 96 | +exports[`React hook transforms should support hook imports with aliasing 1`] = ` |
| 97 | +"import React from \\"react\\"; |
| 98 | +const { |
| 99 | + useState: foo |
| 100 | +} = React;" |
| 101 | +`; |
| 102 | + |
| 103 | +exports[`React hook transforms should support hook imports with no default 1`] = ` |
| 104 | +"import React from \\"react\\"; |
| 105 | +const { |
| 106 | + useState |
| 107 | +} = React;" |
| 108 | +`; |
| 109 | + |
| 110 | +exports[`React hook transforms should support mixed hook imports 1`] = ` |
| 111 | +"import React from \\"react\\"; |
| 112 | +import \\"react\\"; |
| 113 | +const { |
| 114 | + memo, |
| 115 | + useState |
| 116 | +} = React;" |
| 117 | +`; |
| 118 | + |
| 119 | +exports[`React hook transforms should support mixed hook imports with no default #2 1`] = ` |
| 120 | +"import React from \\"react\\"; |
| 121 | +const { |
| 122 | + memo, |
| 123 | + useRef, |
| 124 | + useState |
| 125 | +} = React; |
| 126 | +export const Portal = memo(() => null);" |
| 127 | +`; |
| 128 | + |
| 129 | +exports[`React hook transforms should support mixed hook imports with no default 1`] = ` |
| 130 | +"import React from \\"react\\"; |
| 131 | +const { |
| 132 | + useState |
| 133 | +} = React; |
| 134 | +import \\"react\\"; |
| 135 | +const { |
| 136 | + memo |
| 137 | +} = React;" |
| 138 | +`; |
| 139 | + |
| 140 | +exports[`React hook transforms should support transform hook imports 1`] = ` |
| 141 | +"import React from \\"react\\"; |
| 142 | +const { |
| 143 | + useState |
| 144 | +} = React;" |
| 145 | +`; |
0 commit comments