Skip to content

Commit

Permalink
Merge pull request #35 from inokawa/preact-opt
Browse files Browse the repository at this point in the history
Add option to alias react to preact
  • Loading branch information
inokawa authored May 5, 2021
2 parents d98b113 + e5cf128 commit 118a8f3
Show file tree
Hide file tree
Showing 4 changed files with 236 additions and 55 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,20 @@ module.exports = {
babelTransformerPath: require.resolve('react-native-react-bridge/lib/plugin'),
...
},
rnrb: {
// Set `true` if you use Preact in web side.
// This will alias imports from `react` and `react-dom` to `preact/compat` automatically.
preact: true
},
...
};
```

2. Make entry file for web app.

- If you use React in web, import modules from `react-native-react-bridge/lib/web` and `react`.
- If you use Preact in web, import modules from `react-native-react-bridge/lib/web/preact` and `preact`.
- If you use React in web, import modules from `react` and `react-native-react-bridge/lib/web`.
- If you use Preact in web, import modules from `preact` and `react-native-react-bridge/lib/web/preact`.
- If you use Preact in web but with React aliases, import modules from `react` and `react-native-react-bridge/lib/web`.

```jsx
// WebApp.js
Expand Down
Loading

0 comments on commit 118a8f3

Please sign in to comment.