profile
viewpoint

Stexxe/apiChainning 0

PHP Library for REST API Multiple-Request Chaining - In Dev

Stexxe/react 0

A declarative, efficient, and flexible JavaScript library for building user interfaces.

Stexxe/snake-game 0

Yet another snake game

Stexxe/TetrisUnity 0

Tetris game implementation using Unity3D

Stexxe/umibuild 0

Сборщик расширений UMI.CMS

Stexxe/XsltStat 0

Statistics collector of XSLT-files

fork Stexxe/react

A declarative, efficient, and flexible JavaScript library for building user interfaces.

https://reactjs.org

fork in 24 days

issue commentfacebook/react

False positive getDefaultProps warning when mixing development and production versions

When function createClass is executed and there is getDefaultProps in the spec and we are not in production mode, then we approve that getDefaultProps is intentional. As was mentioned before we approve react class only in development mode, because of performance reasons, so we cannot approve it in any environment.

I think the problem is not in mixing development and production versions, but in relying on isReactClassApproved property. The error message says that: getDefaultProps is only used on classic React.createClass definitions, so from logic of the message we should warn only if we have getDefaultProps and element was created not from React.createClass, despite the fact of mixing environments.

The table below describes different states and where bug occurs.

react create-react-class bug
dev prod (isReactClassApproved is not set)
dev dev - (isReactClassApproved is set)
prod dev - (no check)
prod prod - (no check)

I have two possible ways in mind of how to fix that bug:

  1. We can indicate that type was created from React.createClass by adding some property (like __fromCreateClass) to type on any environment and then check that property exists instead of isReactClassApproved.
  2. From definition of React.createClass, if the spec has getDefaultProps then we execute that function and set its return value to defaultProps property. We could remove that function from Constructor after filling defaultProps if that won't hurt compatibility with older versions.

The question is how we suppose to fix this if there is no React.createClass in master branch, but only in branch 15.6-dev?

mondwan

comment created time in 25 days

create barnchStexxe/sandbox

branch : master

created branch time in 5 months

created repositoryStexxe/sandbox

created time in 5 months

push eventStexxe/currency-exchange

Alexey Tirman

commit sha 51379891280f2671794f561f18a71d7828fcb650

Update README.md

view details

push time in 5 months

push eventStexxe/TetrisUnity

Alexey Tirman

commit sha e3b44d0478077364c860388a7ba78c5b391a9745

Update README.md

view details

push time in 5 months

more