1- import reactCreateClass from "./react-create-class" ;
21import React from "react" ;
32import Globalize from "globalize" ;
43
@@ -23,15 +22,18 @@ function generator(fn, localPropNames, options) {
2322 } ;
2423 var globalizePropNames = commonPropNames . concat ( localPropNames ) ;
2524
26- return reactCreateClass ( {
27- displayName : Fn ,
28- componentWillMount : function ( ) {
25+ return class extends React . Component {
26+ static displayName = Fn ;
27+
28+ componentWillMount ( ) {
2929 this . setup ( this . props ) ;
30- } ,
31- componentWillReceiveProps : function ( nextProps ) {
30+ }
31+
32+ componentWillReceiveProps ( nextProps ) {
3233 this . setup ( nextProps ) ;
33- } ,
34- setup : function ( props ) {
34+ }
35+
36+ setup ( props ) {
3537 this . globalize = props . locale ? Globalize ( props . locale ) : Globalize ;
3638 this . domProps = Object . keys ( props ) . filter ( omit ( globalizePropNames ) ) . reduce ( function ( memo , propKey ) {
3739 memo [ propKey ] = props [ propKey ] ;
@@ -46,11 +48,12 @@ function generator(fn, localPropNames, options) {
4648 beforeFormat . call ( this , props ) ;
4749 var formattedValue = this . globalize [ fn ] . apply ( this . globalize , this . globalizePropValues ) ;
4850 this . value = afterFormat . call ( this , formattedValue ) ;
49- } ,
50- render : function ( ) {
51- return React . DOM . span ( this . domProps , this . value ) ;
5251 }
53- } ) ;
52+
53+ render ( ) {
54+ return React . createElement ( "span" , this . domProps , ...this . value ) ;
55+ }
56+ } ;
5457}
5558
5659export default generator ;
0 commit comments