You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[React 19] Update OSS package imports for consistency with Pro
This PR updates the open-source package to use the same import pattern
as the Pro package, ensuring consistency across the codebase.
## Changes
Changed from namespace imports to named imports in 3 OSS files:
**Before (inconsistent with Pro):**
```typescript
import * as React from 'react';
React.createElement()
React.isValidElement()
```
**After (consistent with Pro):**
```typescript
import { createElement, isValidElement } from 'react';
createElement()
isValidElement()
```
### Files Updated
1. `packages/react-on-rails/src/createReactOutput.ts`
- `React.createElement` → `createElement`
- `React.isValidElement` → `isValidElement`
- `React.ReactElement` type → `ReactElement` type
2. `packages/react-on-rails/src/handleError.ts`
- `React.createElement` → `createElement`
3. `packages/react-on-rails/src/serverRenderReactComponent.ts`
- `React.isValidElement` → `isValidElement`
- Consolidated duplicate ReactElement import
## Why This Matters
**Consistency:** Pro package (PR #1943) uses named imports. This brings OSS in line.
**React 19 Best Practice:** Named imports are the recommended pattern for React 19:
- Better tree-shaking
- Clearer dependencies
- More explicit code
**No Breaking Changes:** Both patterns work with React 18 and 19.
## Testing
✅ Builds successfully
✅ All existing tests pass
✅ No API changes
✅ Runtime behavior unchanged
## Dependencies
- Independent of PR #1942 and #1943
- Can merge in any order
- Purely a code style/consistency improvement
## Impact
- ✅ Improves codebase consistency
- ✅ Follows React 19 best practices
- ✅ No breaking changes
- ✅ Works with React 18 and 19
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
0 commit comments