'Getting TypeError: undefined is not an object (evaluating '_mathjs.default.fraction'), React-Native

I get this error whenever I use 'mathjs'

TypeError: undefined is not an object (evaluating '_mathjs.default.fraction')

Basically my code is this

import React from 'react';
import {View, Button} from 'react-native';
import mathjs from 'mathjs';
const App = () => {
  return (
    <View>
      <Button
        title="TestButton"
        onPress={() => {
           console.log(mathjs.fraction(1, 2)); // equals to ½
         }}
        />
   </View>
  );
};

export default App;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source