score:0
Accepted answer
you have to update your function like this. simply you have to add {
instead of (
and set return
inside the function.
userfriendlydate = (selecteddate) => {
let startmonth = this.dateutil.translatemonthshort(selecteddate.getmonth())
return selecteddate
? [startmonth, selecteddate.getfullyear(),
startmonth].join(' ')
: ' '
}
hope this will help you!
score:0
can you post the error? i suspect it might be because of your parens
userfriendlydate = (selecteddate) => (
try curly braces instead.
userfriendlydate = (selecteddate) => {
the paren is for a multi-line return statement. inside the block (when you use {
) you'll need to add a return
Source: stackoverflow.com
Related Query
- How to create helper file full of functions in react native?
- How to set node env variables (runtime) after build the React project?
- How to set environment variables on React with custom webpack
- How to use props in helper functions in React
- In React how can I set state variables in a loop?
- How can you test functions and variables within your react component's render function?
- How to set the height knowing that under input will helper text appear in React MaterialUI v3.7?
- React: how to set variables in helper functions?
- How to set component default props on React component
- How to set the DefaultRoute to another Route in React Router
- How to set build .env variables when running create-react-app build script?
- How to define css variables in style attribute in React and typescript
- How to set image width to be 100% and height to be auto in react native?
- How to set iframe content of a react component
- How to set up Babel 6 stage 0 with React and Webpack
- How to set state of response from axios in react
- How to pass arguments to functions in React js?
- How to set React to production mode when using Gulp
- react native how to call multiple functions when onPress is clicked
- How to set NODE_ENV from package.json for react
- How to set React component state and props from browser
- how to create common helper class in React JS using ES6 which is used by another component?
- React Native: How to set <TextInput/>'s height and width to <View/> container?
- How to set color to text in React JS
- How can I set initial React state from API data?
- How do I set a marker in MapView of React Native
- How to set event handler in React sub-component
- How to use environment variables in React app hosted in Azure
- How to set the height of button in React Native Android
- How to set environment variable in React JS..?
More Query from same tag
- React get the input type=file value
- React - How do I get fetched data outside of an async function?
- useState in react hooks converting to functional component
- S3 CloudFront React SPA returns 403 due to hashtag but cannot setup 403 error page
- Set state to initial state after clicking the submit button
- React Modal always uses same record from a row
- couldn't get to detail page for each restaurant from my Restaurant list
- Named import in React
- How does redux saga trigger next with in a function
- How to get code coverage inside a callback using jest?
- Why Todo Item only save to localStorage when hit submit button two times?
- Data from API is displaying in the console but not in the DOM, why?
- react-d3-tree error parsing external JSON
- Yup validation of first and last element in array of objects
- How to fix material-kit-react 'module not found: webpack loader error'
- How to insert a repeating <td> in react using a function
- Why is Array.indexOf() working correctly with one redux action but not with another? (same reducer)
- Why does my React app not re-render or display changes on the DOM except I relaod?
- Test button when it is clicked - React testing library
- Awaiting Redux Action w/ React Hooks
- axios baseUrl not working in react when using process.env
- Check if user reached the bottom of the page react
- I can't seem to pass an array of objects as prop (console logs 1 object, [object object] instead)
- Using the same index to map two arrays in React.js
- How to make redux-observable send multiple actions before and after ajax request?
- Redirecting with React
- how generate options for select component dynamically with ant design
- React reducer giving error
- why is first letter dead in react-hook-form input
- Return JSON from sass through window.getComputedStyle in React