From 6cab7495e4ba7e87900950b04f55ecc4e5d4178c Mon Sep 17 00:00:00 2001 From: jquense Date: Sun, 13 Sep 2015 11:57:15 +0300 Subject: [PATCH] change examples to use stateless fn components --- examples/App.js | 12 ++++-------- src/Calendar.jsx | 3 +-- src/EventRow.jsx | 6 +++--- src/Popup.jsx | 2 +- src/Week.jsx | 2 +- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/examples/App.js b/examples/App.js index 035d75c3e..88e51939b 100644 --- a/examples/App.js +++ b/examples/App.js @@ -20,16 +20,12 @@ setLocalizer( globalizeLocalizer(globalize) ); -class EventWeek { - render(){ - return {this.props.event.title} - } +function EventWeek(props) { + return {props.event.title} } -class EventAgenda { - render(){ - return {this.props.event.title} - } +function EventAgenda(props) { + return {props.event.title} } const Example = React.createClass({ diff --git a/src/Calendar.jsx b/src/Calendar.jsx index 58b3135d9..f046be19e 100644 --- a/src/Calendar.jsx +++ b/src/Calendar.jsx @@ -215,7 +215,6 @@ let Calendar = React.createClass({ formats = defaultFormats(formats) let View = VIEWS[view]; - let label = viewLabel(current, view, formats, culture) let names = viewNames(this.props.views) let elementProps = omit(this.props, Object.keys(Calendar.propTypes)) @@ -234,7 +233,7 @@ let Calendar = React.createClass({ date={current} view={view} views={names} - label={label} + label={viewLabel(current, view, formats, culture)} onViewChange={this._view} onNavigate={this._navigate} /> diff --git a/src/EventRow.jsx b/src/EventRow.jsx index 4be886ab0..fee01597f 100644 --- a/src/EventRow.jsx +++ b/src/EventRow.jsx @@ -20,9 +20,9 @@ let propTypes = { }; -let MonthView = React.createClass({ +let EventRow = React.createClass({ - displayName: 'MonthView', + displayName: 'EventRow', propTypes, @@ -100,4 +100,4 @@ let MonthView = React.createClass({ } }); -export default MonthView +export default EventRow diff --git a/src/Popup.jsx b/src/Popup.jsx index 183505c46..24de41ded 100644 --- a/src/Popup.jsx +++ b/src/Popup.jsx @@ -2,7 +2,7 @@ import React from 'react'; import EventCell from './EventCell'; import { isSelected } from './utils/selection'; -class Popup { +class Popup extends React.Component { render() { let { events, selected, ...props } = this.props; diff --git a/src/Week.jsx b/src/Week.jsx index be38d9f84..bb0120880 100644 --- a/src/Week.jsx +++ b/src/Week.jsx @@ -10,7 +10,7 @@ let Week = React.createClass({ propTypes: TimeGrid.propTypes, render() { - let { date, culture } = this.props + let { date } = this.props let { start, end } = Week.range(date, this.props) return (