mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
9c4eefcdbf
* Add prettier for examples directory * Fix files * Fix linting * Add prettier script in case it has to be ran again
40 lines
895 B
JavaScript
40 lines
895 B
JavaScript
import React from 'react'
|
|
import { inject } from 'ioc'
|
|
import PropTypes from 'prop-types'
|
|
|
|
@inject({
|
|
// keep it `isRequired`-free to allow mock injection via props
|
|
Link: PropTypes.func
|
|
})
|
|
export default class extends React.Component {
|
|
static propTypes = {
|
|
// you can add `isRequired` to the component's propTypes definition
|
|
Link: PropTypes.func.isRequired
|
|
}
|
|
|
|
render() {
|
|
const { Link } = this.props
|
|
|
|
return (
|
|
<div
|
|
style={{
|
|
marginTop: '5px',
|
|
border: '1px dashed #00ff00',
|
|
padding: '10px'
|
|
}}
|
|
>
|
|
<h3>Endpoint</h3>
|
|
Uses injected `Link` component without direct dependency on one
|
|
<br />
|
|
<Link route="about" params={{ foo: 'baz' }}>
|
|
<a>About: foo baz</a>
|
|
</Link>
|
|
<br />
|
|
<Link route="/">
|
|
<a>go Home</a>
|
|
</Link>
|
|
</div>
|
|
)
|
|
}
|
|
}
|