I need to write a React/Redux app to translate an English sentence into Pig Latin. I found that there are some already existing npm modules for this purpose, hence thought of reusing them. I wrote a simple functional component for this translation as below.
import _ from 'lodash';
import React from 'react';
import piglatin from 'piglatin';
export default (props) => {
console.log(piglatin.pigatin(props.data));
return (
<label>Hello !</label>
)
}
Simply I just wanted to log the translated text into the console.But when I try that out it gives me an error as below.
Uncaught TypeError: _piglatin2.default.piglatin is not a function
You may find my code here in github. How can I sort this out. Any help is really appreciated.
via Ravindra Ranwala
No comments:
Post a Comment