New App - Garden code example not working? | The place for Zendesk users to come together and share
Skip to main content
Question

New App - Garden code example not working?

  • February 1, 2023
  • 2 replies
  • 2 views

Steven16

Hello all!  I am kinda new to React and want to try updating my existing custom app using the new scaffold.

I started a new app in ZCLI with the react scaffold and it works locally (I see the list of orgs).

However, if I copy the code from https://garden.zendesk.com/components/autocomplete Default layout and replace the contents of app.js with it, I get the following error:

/src/javascripts/modules/app.js: Unexpected token, expected "," (40:19)

  38 |    */
  39 |   const filterMatchingOptionsRef = useRef(
> 40 |     debounce((value: string) => {
     |                    ^
  41 |       const matchedOptions = options.filter(
  42 |         option => option.trim().toLowerCase().indexOf(value.trim().toLowerCase()) !== -1
43 |       );

Any ideas what I am doing wrong?  I made no other modification to the scaffold created by zcli.

Also to note, I have tried this using npm and yarn - same issue.

2 replies

Steven16
  • Author
  • February 2, 2023

Thanks for that advice!  Funny, it got passed that, but now I get this error.


Steven16
  • Author
  • February 3, 2023

I found that I couldn't replace the scaffold app.js.  When I import the sample as another JS and put it inside the <render> tags, it works.  So, the issue was there was this thing being built, but no command to display it.

Thank you again for your comment, but wanted to note this in case someone else comes across it.