I know its been posted a few times but history is ...
# suitescript
c
I know its been posted a few times but history is bad since this is free.. who had the ReactJS stuff working ok in netsuite? i got the sample app done (tic/tac-toe game) an d i was jsut trying to see if i could get it working.. did the prod compile and uploaded it and i can access an index.js and the page title loads but there's no content.. wasn't sure if the relative links are just bad in the compiled code for the netsuite file cabinet or what.
j
Have an inlinehtml field somewhere like
<div id="react-root" />
Then run in a client script call
Copy code
require(['react', 'react-dom'], function(React, ReactDOM) {
  ReactDOM.render(
    React.createElement(your element, { your props }),
    document.getElementById('react-root')
  );
});
I have the paths to react and react-dom set up in an @NAmdConfig file
c
the AMD config may be the issue
i wrote the app and compiled so i was expecting to be able to plop it down and write it back as a suitelet and just use it but the relative paths is what is throwing it off I believe
i guess fora suitelet you'd have an empty html div and then maybe you attach it to that
j
yeah in my suitelet I have an inline html div with the css in a
<style>
followed by
<div id="react-root"></div>
A pageInit function on the client script attached to the suitelet then requires the other scripts and initializes the react app
c
have you tried pulling in any additional components? I think it would be awesome to be able to pull in some of the stuff like the "loading/waiting" spinners and have the nice ingle page app UI
j
I have my component defined in another file and I pull it in in the same require function as
react
and
react-dom
As far as I understand, everything works ok as long as you use one
require
function to bring in your client side dependencies, since NetSuite does not run server-side static analysis on client scripts you
require
not sure if that answers your question though
c
right.. ok cool ill give that some more work and see how it turns out.. do you have any UI screenshots of how its looking/working by chance?
j
yeah I've been meaning to update the repo
c
ill just have to mess w/ it honestly.. once i get it up and running ill be ok
j
i'll take a screenshot
c
alright cool
i just wanna get away from jquery ui and have a nicer "more modern" UI... also thinking about using this on some client stuff and maybe a suiteworld talk about using it for better UIs
j
Number of records in the stages weren't high but you get the idea
c
looks nice
j
thanks since it's not so complicated it's not anything you couldn't make with jquery ui, but part of me just wanted to see if it would work in NetSuite
c
yep thats where I'm at but a more complicated UI
For example like an item search as a single page app that replaces netsuite's lagging one
but looks good and is responsive
s
please rewrite the NS UI and share
🤖 1
c
ha i wish.. i've re-done the item search before for a custom version it was so much faster/easier than the native one
but it was still jQuery UI which i want to not use
k
Have you tried Material CSS
c
i haven't
i am not a front end web guy i just wanna give it a go to see whats up
Still waiting for Blizzard Entertainment to offer me a job
s
how does Blizzard factor in?
c
im only doing netsuite till that happens
so doing something that isnt' netsuite makes me happy
🙂 1
a
@creece You can always do Uber and have an small job with more free time ....
😂 1
c
no uber man... im not picking up weirdos
🤣 1
m
@stalbert I actually started doing this but with vue.js instead of react. I have a project in production that uses it but it's still rough on the edges. The eventual plan is to release it as a library
c
what is the rough around the edges part
like what issues are/did you have?
s
I'd prefer vuejs over react any day, so thumbs up and keep going @michoel!
m
@creece no specific issues, just that the code is more proof of concept than production quality (even though I'm using it for a released project..)
I actually have the day off today (Melbourne Cup Day), maybe I'll try put something up on github
k
@michoel post repository link, 😬
c
is there something worth doing vue over react?
i don't know a ton about them just that its a JS library for building UIs
m
Mostly personal taste. React is more mature, much larger eco system, but vuejs is becoming increasingly popular
c
im guessing they both have pretty similar pain points in getting it working
✔️ 1
j
I initially tried out vue because it doesn't take a lot to introduce it to a project. However I had a very confusing time trying to go beyond just introducing it. I thought the API had too much magic going on (where I have found the React API to be very intuitive). Like React, Vue has type definitions for typescript, but Vue's type definitions are incredibly confusing. https://github.com/vuejs/vue/blob/dev/types/vue.d.ts#L105 There were many different ways to do the same thing so the examples I was looking at were all using different patterns and idioms. Single file vue components (separate file type with a .vue extension) is where I thought it had just gone too far from where I wanted to be.