cleanup: defaultProps -> JS default params on our function components
React 19 drops defaultProps on function components. Converted the 9 of
ours that used it (App, Navigation, ReSendEmail, Reconnect, OAuthLoginButton,
PageHeader, Page, EditDocument, EditSubscription) to destructured default
params; App defaults userId/emailAddress in its withTracker instead (it
spreads {...props} widely). Class components keep defaultProps (still
supported). The only defaultProps warnings left are from the react-share
npm package (CreatedButton/Icon), not our code. REST smoke byte-identical.
This commit is contained in:
parent
5661e129fb
commit
4ddaa0d8ec
9 changed files with 17 additions and 51 deletions
|
|
@ -6,17 +6,13 @@ import Subscriptions from '../../../api/Subscriptions/Subscriptions';
|
|||
import SubscriptionEditor from '../../components/SubscriptionEditor/SubscriptionEditor';
|
||||
import NotFound from '../NotFound/NotFound';
|
||||
|
||||
const EditSubscription = ({ doc, history }) => (doc ? (
|
||||
const EditSubscription = ({ doc = null, history }) => (doc ? (
|
||||
<div className="EditSubscription">
|
||||
<h4 className="page-header">{`Editing "${doc.title}"`}</h4>
|
||||
<SubscriptionEditor doc={doc} history={history} />
|
||||
</div>
|
||||
) : <NotFound />);
|
||||
|
||||
EditSubscription.defaultProps = {
|
||||
doc: null
|
||||
};
|
||||
|
||||
EditSubscription.propTypes = {
|
||||
doc: PropTypes.object,
|
||||
history: PropTypes.object.isRequired
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue