Skip to content

Commit

Permalink
Use JSX syntax highlighting in the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
silvenon committed Jan 19, 2016
1 parent af93c52 commit 89f931f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ npm install react react-dom react-portal --save
```

## Usage
```javascript
```jsx
import React from 'react';
import ReactDOM from 'react-dom';
import Portal from 'react-portal';
Expand Down Expand Up @@ -117,7 +117,7 @@ This callback is called when the portal is (re)rendered.
- Does your modal have a fullscreen overlay and the `closeOnOutsideClick` doesn't work? [There is a simple solution](https://github.com/tajo/react-portal/issues/2#issuecomment-92058826).
- Does your inner inner component `<LevelTwo />`

```js
```jsx
<Portal>
<LevelOne>
<LevelTwo />
Expand All @@ -127,7 +127,7 @@ This callback is called when the portal is (re)rendered.

also needs an access to `this.props.closePortal()`? You can't just use `{this.props.children}` in render method of `<LevelOne>` component. You have to clone it instead:

```js
```jsx
{React.cloneElement(
this.props.children,
{closePortal: this.props.closePortal}
Expand All @@ -141,15 +141,15 @@ Please, skip this section if you dislike dirty tricks.

However, then it's completely up to you to take care about the open state. You have to write all the closing logic! And that sucks. But there is a dirty trick:

```javascript
```jsx
<Portal openByClickOn={<span ref="myLittleSecret" />}>
<Modal title="My modal">
Modal content
</Modal>
</Portal>
```

```javascript
```jsx
ReactDOM.findDOMNode(this.refs.myLittleSecret).click();
// opens the portal, yay!
```
Expand Down

0 comments on commit 89f931f

Please sign in to comment.