We were loading the entire frint-react library inside the render function, when we only needed one specific module there.
We were doing it like this so far for frint-compat for supporting v0.x users, which is not needed any more.
2: react-dom imported inside render
react-dom is now imported inside the render function. This has no side-effect, and is mainly done for making way for supporting React Native soon.
React Native doesn't require react-dom, and react-dom is treated as a peer dependency of frint-react.
This means when frint-react will be used in a React Native project, where the developer doesn't need to install react-dom, it will not throw any error when any module is imported from the package like this:
import { observe } from 'frint-react';
Directly importing the module from package like this will also bring inrender as a function, but since that function will never be executed, it means react-dom will also never be required, resulting in no error.
Coverage decreased (-0.006%) to 97.47% when pulling b84f04c94e4e50ee88ba321209c5105ad4448738 on frint-react-render into 82ce4baf11ac98d0059f33cd502e45e3309f6644 on master.
What's done
1: Import only required modules
We were loading the entire
frint-react
library inside therender
function, when we only needed one specific module there.We were doing it like this so far for
frint-compat
for supporting v0.x users, which is not needed any more.2:
react-dom
imported insiderender
react-dom
is now imported inside therender
function. This has no side-effect, and is mainly done for making way for supporting React Native soon.React Native doesn't require
react-dom
, andreact-dom
is treated as a peer dependency offrint-react
.This means when
frint-react
will be used in a React Native project, where the developer doesn't need to installreact-dom
, it will not throw any error when any module is imported from the package like this:Directly importing the module from package like this will also bring in
render
as a function, but since that function will never be executed, it meansreact-dom
will also never be required, resulting in no error.