docs: https://facebook.github.io/react/docs/react-api.html#react.purecomponent
shouldComponentUpdate to opt out of pure renderingjust in case it helps, here's the ruby script I used to make this change in our codebase. (Note that it isn't designed to be robust, it might not work in cases with multiple decorators, etc.) You want to run it in your root src directory.
files = Dir['**/*.{ts,tsx}']
files.each do |f|
lines = File.readlines(f)
lines.delete_if { |line| line =~ /import|require/ && line =~ /pure-render-decorator/ }
# remove line with decorator, change if you use a different import name
while decorator_index = lines.find_index { |line| line =~ /@PureRender/ }
lines[decorator_index + 1].sub!(/Component</, 'PureComponent<')
lines.delete_at(decorator_index)
end
File.write(f, lines.join(''))
end
Also, doing this means the peerDependencies on React will have to be bumped to ^15.3.0 or something similar. It might be prudent to hold off for a little on doing this to not force people to upgrade React
馃敟 breaking change because it requires React >= 15.3!
In package.json react requirement is already >= 15.5.1, is this still beraking change?
@betalb no, the peerDependency still includes react v0.14 and will stay that way until blueprint core 2.0: https://github.com/palantir/blueprint/blob/3782d6d2ac5c0eacd21bfa2d6a03c75dd9e6d804/packages/core/package.json#L20
Most helpful comment
just in case it helps, here's the ruby script I used to make this change in our codebase. (Note that it isn't designed to be robust, it might not work in cases with multiple decorators, etc.) You want to run it in your root
srcdirectory.Also, doing this means the peerDependencies on React will have to be bumped to
^15.3.0or something similar. It might be prudent to hold off for a little on doing this to not force people to upgrade React