Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bberak/react-inline-script
Inject arbitrary javascript and inline <script> tags into your DOM and React app without any hassles.
https://github.com/bberak/react-inline-script
Last synced: 26 days ago
JSON representation
Inject arbitrary javascript and inline <script> tags into your DOM and React app without any hassles.
- Host: GitHub
- URL: https://github.com/bberak/react-inline-script
- Owner: bberak
- License: mit
- Created: 2018-02-25T23:46:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-21T05:28:08.000Z (about 6 years ago)
- Last Synced: 2024-09-24T07:45:48.717Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 66.4 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-inline-script
Inject arbitrary javascript and inline `````` tags into your DOM and React app without any hassles.
## Usage
```javascript
import React from 'react'
import Script from "react-inline-script"export default class PageLayout extends React.Component {
constructor(props) {
super(props)
}render() {
return (
<div id="some-content">
<Script>alert("hi there!")
)
}
}
```For multiline scripts, just wrap your contents in ```{` /* Your script */ `}```:
```javascript
import React from 'react'
import Script from "react-inline-script"export default class PageLayout extends React.Component {
constructor(props) {
super(props)
}render() {
return (
)
{`
const test = true
if (test)
alert("howdy!")
`}
}
}
```